Class ReleasableBytesStreamOutput
- java.lang.Object
-
- java.io.OutputStream
-
- org.elasticsearch.common.io.stream.StreamOutput
-
- org.elasticsearch.common.io.stream.BytesStream
-
- org.elasticsearch.common.io.stream.BytesStreamOutput
-
- org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,Releasable
public class ReleasableBytesStreamOutput extends BytesStreamOutput implements Releasable
An bytes stream output that allows providing aBigArrays
instance expecting it to require releasing its content (bytes()
) once done.Please note, closing this stream will release the bytes that are in use by any
ReleasablePagedBytesReference
returned frombytes()
, so this stream should only be closed after the bytes have been output or copied elsewhere.
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.common.io.stream.BytesStreamOutput
bigArrays, bytes, count
-
-
Constructor Summary
Constructors Constructor Description ReleasableBytesStreamOutput(int expectedSize, BigArrays bigArrays)
ReleasableBytesStreamOutput(BigArrays bigarrays)
-
Method Summary
Modifier and Type Method Description ReleasablePagedBytesReference
bytes()
Returns aReleasable
implementation of aBytesReference
that represents the current state of the bytes in the stream.void
close()
Closes this stream to further operations.void
reset()
-
Methods inherited from class org.elasticsearch.common.io.stream.BytesStreamOutput
flush, position, ramBytesUsed, seek, size, skip, writeByte, writeBytes
-
Methods inherited from class org.elasticsearch.common.io.stream.StreamOutput
getVersion, hasFeature, setFeatures, setVersion, write, write, writeArray, writeArray, writeBoolean, writeByteArray, writeBytes, writeBytes, writeBytesRef, writeBytesReference, writeCollection, writeCollection, writeDouble, writeDoubleArray, writeEnum, writeEnumSet, writeException, writeFloat, writeFloatArray, writeGenericValue, writeGeoPoint, writeInstant, writeInt, writeIntArray, writeList, writeLong, writeLongArray, writeMap, writeMap, writeMapOfLists, writeMapWithConsistentOrder, writeNamedWriteable, writeNamedWriteableList, writeOptionalArray, writeOptionalArray, writeOptionalBoolean, writeOptionalBytesReference, writeOptionalDouble, writeOptionalFloat, writeOptionalInstant, writeOptionalLong, writeOptionalNamedWriteable, writeOptionalStreamable, writeOptionalString, writeOptionalStringArray, writeOptionalText, writeOptionalTimeValue, writeOptionalTimeZone, writeOptionalVInt, writeOptionalWriteable, writeShort, writeStreamableList, writeString, writeStringArray, writeStringArrayNullable, writeStringCollection, writeText, writeTimeValue, writeTimeZone, writeVInt, writeVIntArray, writeVLong, writeVLongArray, writeZLong
-
-
-
-
Method Detail
-
bytes
public ReleasablePagedBytesReference bytes()
Returns aReleasable
implementation of aBytesReference
that represents the current state of the bytes in the stream.- Overrides:
bytes
in classBytesStreamOutput
-
close
public void close()
Description copied from class:StreamOutput
Closes this stream to further operations.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceReleasable
- Overrides:
close
in classBytesStreamOutput
-
reset
public void reset()
- Overrides:
reset
in classBytesStreamOutput
-
-