java.lang.Object
java.io.InputStream
org.elasticsearch.common.io.stream.StreamInput
org.elasticsearch.common.io.stream.FilterStreamInput
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
BufferedChecksumStreamInput,NamedWriteableAwareStreamInput
Wraps a
StreamInput and delegates to it. To be used to add functionality to an existing stream by subclassing.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()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 stream.The transport version the data is serialized as.Get the registry of named writeables if this stream has one,nullotherwise.intread()intread(byte[] b, int off, int len) Reads all remaining bytes in the stream as a releasable bytes reference.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.Reads a releasable bytes reference from this stream.readReleasableBytesReference(int length) Same asStreamInput.readBytesReference()but with an explicitly provided length.shortReads the same bytes returned byStreamInput.readReleasableBytesReference()but does not retain a reference to these bytes.intreadVInt()Reads an int stored in variable-length format.longReads a long stored in variable-length format.voidreset()voidsetTransportVersion(TransportVersion version) Set the transport version of the data in this stream.booleanChecks if thisInputStreamsupportsStreamInput.readAllToReleasableBytesReference().Methods inherited from class org.elasticsearch.common.io.stream.StreamInput
doReadString, readArray, readArraySize, readBigInteger, readBoolean, readByteArray, readBytesRef, readBytesRef, readBytesReference, readBytesReference, readCollection, readCollectionAsImmutableList, readCollectionAsImmutableSet, readCollectionAsList, readCollectionAsSet, readDouble, readDoubleArray, readEnum, readEnumSet, readException, readFloat, readFloatArray, readFully, readGenericMap, readGenericValue, readGeoPoint, readImmutableMap, readImmutableMap, readImmutableOpenMap, readInstant, readIntArray, readLongArray, readMap, readMap, readMapOfLists, readMapValues, readNamedWriteable, readNamedWriteable, readNamedWriteableCollectionAsList, readOptional, readOptionalArray, readOptionalBoolean, readOptionalByteArray, readOptionalBytesReference, readOptionalCollectionAsList, readOptionalDouble, readOptionalEnum, readOptionalFloat, readOptionalFloatArray, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalSecureString, readOptionalString, readOptionalStringArray, readOptionalStringCollectionAsList, readOptionalText, readOptionalTimeValue, readOptionalVInt, readOptionalVLong, readOptionalWriteable, readOptionalZoneId, readOrderedMap, readSecureString, readSlicedBytesReference, readStringArray, readStringCollectionAsImmutableList, readStringCollectionAsList, readText, readTimeValue, readVIntArray, readVIntSlow, readVLongArray, readVLongSlow, readZLong, readZoneId, throwEOF, throwOnBrokenVInt, throwOnBrokenVLong, throwOnNullRead, tryReadStringFromBytes, wrap, wrapMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Field Details
-
delegate
-
-
Constructor Details
-
FilterStreamInput
-
-
Method Details
-
readString
- Overrides:
readStringin classStreamInput- Throws:
IOException
-
readByte
Description copied from class:StreamInputReads and returns a single byte.- Specified by:
readBytein classStreamInput- Throws:
IOException
-
readBytes
Description 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
-
readReleasableBytesReference
Description copied from class:StreamInputReads a releasable bytes reference from this stream. UnlikeStreamInput.readBytesReference()the returned bytes reference may reference bytes in a pooled buffer and must be explicitly released viaReleasableBytesReference.close()once no longer used. Prefer this method overStreamInput.readBytesReference()when reading large bytes references to avoid allocations and copying.- Overrides:
readReleasableBytesReferencein classStreamInput- Throws:
IOException
-
readReleasableBytesReference
Description copied from class:StreamInputSame asStreamInput.readBytesReference()but with an explicitly provided length.- Overrides:
readReleasableBytesReferencein classStreamInput- Parameters:
length- number of bytes to read- Throws:
IOException
-
supportReadAllToReleasableBytesReference
public boolean supportReadAllToReleasableBytesReference()Description copied from class:StreamInputChecks if thisInputStreamsupportsStreamInput.readAllToReleasableBytesReference().- Overrides:
supportReadAllToReleasableBytesReferencein classStreamInput
-
readAllToReleasableBytesReference
Description copied from class:StreamInputReads all remaining bytes in the stream as a releasable bytes reference. Similarly toStreamInput.readReleasableBytesReference()the returned bytes reference may reference bytes in a pooled buffer and must be explicitly released viaReleasableBytesReference.close()once no longer used. However, unlikeStreamInput.readReleasableBytesReference(), this method doesn't have the prefix size.NOTE: Always check
StreamInput.supportReadAllToReleasableBytesReference()before calling this method.- Overrides:
readAllToReleasableBytesReferencein classStreamInput- Throws:
IOException
-
readSlicedBytesReference
Description copied from class:StreamInputReads the same bytes returned byStreamInput.readReleasableBytesReference()but does not retain a reference to these bytes. The returnedBytesReferencethus only contains valid content as long as the underlying buffer has not been released. This method should be preferred overStreamInput.readReleasableBytesReference()when the returned reference is known to not be used past the lifetime of the underlying buffer as it requires fewer allocations and does not require a potentially costly reference count change.- Overrides:
readSlicedBytesReferencein classStreamInput- Throws:
IOException
-
readShort
- Overrides:
readShortin classStreamInput- Throws:
IOException
-
readInt
Description copied from class:StreamInputReads four bytes and returns an int.- Overrides:
readIntin classStreamInput- Throws:
IOException
-
readLong
Description copied from class:StreamInputReads eight bytes and returns a long.- Overrides:
readLongin classStreamInput- Throws:
IOException
-
readVInt
Description copied from class:StreamInputReads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers will always use all 5 bytes and are therefore better serialized usingStreamInput.readInt()- Overrides:
readVIntin classStreamInput- Throws:
IOException
-
readVLong
Description copied from class:StreamInputReads a long stored in variable-length format. Reads between one and ten bytes. Smaller values take fewer bytes. Negative numbers are encoded in ten bytes so preferStreamInput.readLong()orStreamInput.readZLong()for negative numbers.- Overrides:
readVLongin classStreamInput- Throws:
IOException
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classStreamInput- Throws:
IOException
-
close
Description copied from class:StreamInputCloses the stream to further operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classStreamInput- Throws:
IOException
-
available
- Specified by:
availablein classStreamInput- Throws:
IOException
-
getTransportVersion
Description copied from class:StreamInputThe transport version the data is serialized as.- Overrides:
getTransportVersionin classStreamInput
-
setTransportVersion
Description copied from class:StreamInputSet the transport version of the data in this stream.- Overrides:
setTransportVersionin classStreamInput
-
ensureCanReadBytes
Description copied from class:StreamInputThis method throws anEOFExceptionif the given number of bytes can not be read from the 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
-
namedWriteableRegistry
Description copied from class:StreamInputGet the registry of named writeables if this stream has one,nullotherwise.- Overrides:
namedWriteableRegistryin classStreamInput
-