Class FastByteArrayInputStream
java.lang.Object
java.io.InputStream
com.espertech.esper.common.internal.serde.serdeset.builtin.FastByteArrayInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Fast byte array input stream, does not synchronize or check buffer overflow.
-
Constructor Summary
ConstructorDescriptionFastByteArrayInputStream
(byte[] buffer) Ctor.FastByteArrayInputStream
(byte[] buffer, int offset, int length) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionint
final byte[]
getBytes()
Returns the buffer.final int
Returns buffer length.final int
Returns buffer offset.void
mark
(int readLimit) boolean
int
read()
int
read
(byte[] toBuf) int
read
(byte[] target, int offset, int length) Read bytes to buffer.final int
readFast()
Fast read without sync.final int
readFast
(byte[] target) Read bytes.final int
readFast
(byte[] target, int offset, int length) Read bytes.void
reset()
void
setBytes
(byte[] bytes) Sets buffer.void
setLength
(int length) Set length of buffer.void
setOffset
(int offset) Sets buffer offset.long
skip
(long count) final void
skipFast
(int count) Fast skip.Methods inherited from class java.io.InputStream
close, nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
FastByteArrayInputStream
public FastByteArrayInputStream(byte[] buffer) Ctor.- Parameters:
buffer
- to use
-
FastByteArrayInputStream
public FastByteArrayInputStream(byte[] buffer, int offset, int length) Ctor.- Parameters:
buffer
- buffer to useoffset
- offset to start atlength
- length of buffer to use
-
-
Method Details
-
getBytes
public final byte[] getBytes()Returns the buffer.- Returns:
- buffer
-
getLength
public final int getLength()Returns buffer length.- Returns:
- length
-
getOffset
public final int getOffset()Returns buffer offset.- Returns:
- offset
-
setBytes
public void setBytes(byte[] bytes) Sets buffer.- Parameters:
bytes
- to set
-
setLength
public void setLength(int length) Set length of buffer.- Parameters:
length
- buffer length
-
setOffset
public void setOffset(int offset) Sets buffer offset.- Parameters:
offset
- to set
-
read
Read bytes to buffer.- Overrides:
read
in classInputStream
- Parameters:
target
- target bufferoffset
- buffer offsetlength
- buffer length- Returns:
- number of bytes read
- Throws:
IOException
- indicates error
-
available
public int available()- Overrides:
available
in classInputStream
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
reset
public void reset()- Overrides:
reset
in classInputStream
-
skip
public long skip(long count) - Overrides:
skip
in classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
mark
public void mark(int readLimit) - Overrides:
mark
in classInputStream
-
skipFast
public final void skipFast(int count) Fast skip.- Parameters:
count
- bytes to skip
-
readFast
public final int readFast()Fast read without sync.- Returns:
- read byte
-
readFast
public final int readFast(byte[] target) Read bytes.- Parameters:
target
- to fill- Returns:
- num bytes
-
readFast
public final int readFast(byte[] target, int offset, int length) Read bytes.- Parameters:
target
- to filloffset
- to filllength
- length to use- Returns:
- num bytes read
-