Class ByteBufferStreamInput
- java.lang.Object
-
- java.io.InputStream
-
- org.elasticsearch.common.io.stream.StreamInput
-
- org.elasticsearch.common.io.stream.ByteBufferStreamInput
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ByteBufferStreamInput extends StreamInput
-
-
Constructor Summary
Constructors Constructor Description ByteBufferStreamInput(java.nio.ByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
Closes the stream to further operations.protected void
ensureCanReadBytes(int length)
This method throws anEOFException
if the given number of bytes can not be read from the this stream.void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b, int off, int len)
byte
readByte()
Reads and returns a single byte.void
readBytes(byte[] b, int offset, int len)
Reads a specified number of bytes into an array at the specified offset.void
reset()
long
skip(long n)
-
Methods inherited from class org.elasticsearch.common.io.stream.StreamInput
getVersion, readArray, readBoolean, readByteArray, readBytesRef, readBytesRef, readBytesReference, readBytesReference, readDouble, readDoubleArray, readEnum, readEnumSet, readException, readFloat, readFloatArray, readFully, readGenericValue, readGeoPoint, readInt, readIntArray, readList, readLong, readLongArray, readMap, readMap, readMapOfLists, readNamedWriteable, readNamedWriteable, readNamedWriteableList, readOptionalArray, readOptionalBoolean, readOptionalBytesReference, readOptionalDouble, readOptionalFloat, readOptionalLong, readOptionalNamedWriteable, readOptionalStreamable, readOptionalString, readOptionalStringArray, readOptionalText, readOptionalTimeValue, readOptionalTimeZone, readOptionalVInt, readOptionalWriteable, readSet, readShort, readStreamableList, readString, readStringArray, readText, readTimeValue, readTimeZone, readVInt, readVIntArray, readVLong, readVLongArray, readZLong, setVersion, wrap, wrap
-
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
readByte
public byte readByte() throws java.io.IOException
Description copied from class:StreamInput
Reads and returns a single byte.- Specified by:
readByte
in classStreamInput
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
readBytes
public void readBytes(byte[] b, int offset, int len) throws java.io.IOException
Description copied from class:StreamInput
Reads a specified number of bytes into an array at the specified offset.- Specified by:
readBytes
in classStreamInput
- Parameters:
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to read- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Specified by:
available
in classStreamInput
- Throws:
java.io.IOException
-
ensureCanReadBytes
protected void ensureCanReadBytes(int length) throws java.io.EOFException
Description copied from class:StreamInput
This method throws anEOFException
if the given number of bytes can not be read from the this stream. This method might be a no-op depending on the underlying implementation if the information of the remaining bytes is not present.- Specified by:
ensureCanReadBytes
in classStreamInput
- Throws:
java.io.EOFException
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
close
public void close() throws java.io.IOException
Description copied from class:StreamInput
Closes the stream to further operations.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classStreamInput
- Throws:
java.io.IOException
-
-