Class ByteBufferStreamInput
- java.lang.Object
-
- java.io.InputStream
-
- org.elasticsearch.common.io.stream.StreamInput
-
- org.elasticsearch.common.io.stream.ByteBufferStreamInput
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ByteBufferStreamInput extends StreamInput
-
-
Constructor Summary
Constructors Constructor Description ByteBufferStreamInput(ByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()Closes the stream to further operations.protected voidensureCanReadBytes(int length)This method throws anEOFExceptionif the given number of bytes can not be read from the this stream.voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b, int off, int len)bytereadByte()Reads and returns a single byte.voidreadBytes(byte[] b, int offset, int len)Reads a specified number of bytes into an array at the specified offset.intreadInt()Reads four bytes and returns an int.longreadLong()Reads eight bytes and returns a long.shortreadShort()voidreset()longskip(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, readInstant, readIntArray, readList, readLongArray, readMap, readMap, readMapOfLists, readNamedWriteable, readNamedWriteable, readNamedWriteableList, readOptionalArray, readOptionalBoolean, readOptionalBytesReference, readOptionalDouble, readOptionalFloat, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalSecureString, readOptionalString, readOptionalStringArray, readOptionalText, readOptionalTimeValue, readOptionalTimeZone, readOptionalVInt, readOptionalWriteable, readOptionalZoneId, readSecureString, readSet, readString, readStringArray, readStringList, readText, readTimeValue, readTimeZone, readVInt, readVIntArray, readVLong, readVLongArray, readZLong, readZoneId, setVersion, wrap, wrap
-
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ByteBufferStreamInput
public ByteBufferStreamInput(ByteBuffer buffer)
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
readByte
public byte readByte() throws IOExceptionDescription copied from class:StreamInputReads and returns a single byte.- Specified by:
readBytein classStreamInput- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
readBytes
public void readBytes(byte[] b, int offset, int len) throws IOExceptionDescription copied from class:StreamInputReads a specified number of bytes into an array at the specified offset.- Specified by:
readBytesin 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:
IOException
-
readShort
public short readShort() throws IOException- Overrides:
readShortin classStreamInput- Throws:
IOException
-
readInt
public int readInt() throws IOExceptionDescription copied from class:StreamInputReads four bytes and returns an int.- Overrides:
readIntin classStreamInput- Throws:
IOException
-
readLong
public long readLong() throws IOExceptionDescription copied from class:StreamInputReads eight bytes and returns a long.- Overrides:
readLongin classStreamInput- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Specified by:
availablein classStreamInput- Throws:
IOException
-
ensureCanReadBytes
protected void ensureCanReadBytes(int length) throws EOFExceptionDescription copied from class:StreamInputThis method throws anEOFExceptionif 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:
ensureCanReadBytesin classStreamInput- Throws:
EOFException
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
close
public void close() throws IOExceptionDescription copied from class:StreamInputCloses the stream to further operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classStreamInput- Throws:
IOException
-
-