Class InputStreamStreamInput
- java.lang.Object
-
- java.io.InputStream
-
- org.elasticsearch.common.io.stream.StreamInput
-
- org.elasticsearch.common.io.stream.InputStreamStreamInput
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class InputStreamStreamInput extends StreamInput
-
-
Constructor Summary
Constructors Constructor Description InputStreamStreamInput(java.io.InputStream is)Creates a new InputStreamStreamInput with unlimited sizeInputStreamStreamInput(java.io.InputStream is, long sizeLimit)Creates a new InputStreamStreamInput with a size limit
-
Method Summary
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)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.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, readInt, readIntArray, readList, readLong, readLongArray, readMap, readMap, readMapOfLists, readNamedWriteable, readNamedWriteable, readNamedWriteableList, readOptionalArray, readOptionalBoolean, readOptionalBytesReference, readOptionalDouble, readOptionalFloat, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalStreamable, readOptionalString, readOptionalStringArray, readOptionalText, readOptionalTimeValue, readOptionalTimeZone, readOptionalVInt, readOptionalWriteable, readOptionalZoneId, readSet, readShort, readStreamableList, readString, readStringArray, readStringList, readText, readTimeValue, readTimeZone, readVInt, readVIntArray, readVLong, readVLongArray, readZLong, readZoneId, setVersion, wrap, wrap
-
-
-
-
Constructor Detail
-
InputStreamStreamInput
public InputStreamStreamInput(java.io.InputStream is)
Creates a new InputStreamStreamInput with unlimited size- Parameters:
is- the input stream to wrap
-
InputStreamStreamInput
public InputStreamStreamInput(java.io.InputStream is, long sizeLimit)Creates a new InputStreamStreamInput with a size limit- Parameters:
is- the input stream to wrapsizeLimit- a hard limit of the number of bytes in the given input stream. This is used for internal input validation
-
-
Method Detail
-
readByte
public byte readByte() throws java.io.IOExceptionDescription copied from class:StreamInputReads and returns a single byte.- Specified by:
readBytein classStreamInput- Throws:
java.io.IOException
-
readBytes
public void readBytes(byte[] b, int offset, int len) throws java.io.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:
java.io.IOException
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classjava.io.InputStream
-
close
public void close() throws java.io.IOExceptionDescription copied from class:StreamInputCloses the stream to further operations.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classStreamInput- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException- Specified by:
availablein classStreamInput- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
ensureCanReadBytes
protected void ensureCanReadBytes(int length) throws java.io.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:
java.io.EOFException
-
-