Module org.elasticsearch.server
Class BytesRefStreamOutput
java.lang.Object
java.io.OutputStream
org.elasticsearch.common.io.stream.StreamOutput
org.elasticsearch.common.io.stream.BytesRefStreamOutput
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable,- org.apache.lucene.util.Accountable
public class BytesRefStreamOutput
extends StreamOutput
implements org.apache.lucene.util.Accountable
A @link 
StreamOutput that is backed by a BytesRef.
 This is useful for small data, for larger or unknown sizes use BytesStreamOutput instead.
 Compared to BytesStreamOutput this class avoids copying the bytes ref.
 Compared to BytesRefBuilder this class supports writing all the rich data types that StreamOutput supports.- 
Field SummaryFields inherited from interface org.apache.lucene.util.AccountableNULL_ACCOUNTABLE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes this stream to further operations.voidflush()Forces any buffered output to be written.org.apache.lucene.util.BytesRefget()longposition()longvoidreset()voidwriteByte(byte b) Writes a single byte.voidwriteBytes(byte[] b, int offset, int length) Writes an array of bytes.Methods inherited from class org.elasticsearch.common.io.stream.StreamOutputcheckWriteable, getVersion, setVersion, write, write, writeArray, writeArray, writeBoolean, writeByteArray, writeBytes, writeBytes, writeBytesRef, writeBytesReference, writeCollection, writeCollection, writeDouble, writeDoubleArray, writeEnum, writeEnumSet, writeException, writeFloat, writeFloatArray, writeGenericList, writeGenericMap, writeGenericNull, writeGenericString, writeGenericValue, writeGeoPoint, writeInstant, writeInt, writeIntArray, writeList, writeLong, writeLongArray, writeMap, writeMap, writeMapOfLists, writeMapValues, writeMapValues, writeMapWithConsistentOrder, writeMissingString, writeMissingWriteable, writeNamedWriteable, writeNamedWriteableList, writeOptionalArray, writeOptionalArray, writeOptionalBoolean, writeOptionalBytesReference, writeOptionalCollection, writeOptionalCollection, writeOptionalDouble, writeOptionalEnum, writeOptionalFloat, writeOptionalInstant, writeOptionalInt, writeOptionalLong, writeOptionalNamedWriteable, writeOptionalSecureString, writeOptionalString, writeOptionalStringArray, writeOptionalStringCollection, writeOptionalText, writeOptionalTimeValue, writeOptionalVInt, writeOptionalVLong, writeOptionalWriteable, writeOptionalZoneId, writeSecureString, writeShort, writeString, writeStringArray, writeStringArrayNullable, writeStringCollection, writeText, writeTimeValue, writeVInt, writeVIntArray, writeVLong, writeVLongArray, writeWithSizePrefix, writeZLong, writeZoneIdMethods inherited from class java.io.OutputStreamnullOutputStream, writeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.AccountablegetChildResources
- 
Constructor Details- 
BytesRefStreamOutputpublic BytesRefStreamOutput()
 
- 
- 
Method Details- 
getpublic org.apache.lucene.util.BytesRef get()
- 
positionpublic long position()- Overrides:
- positionin class- StreamOutput
 
- 
writeBytepublic void writeByte(byte b) Description copied from class:StreamOutputWrites a single byte.- Specified by:
- writeBytein class- StreamOutput
 
- 
writeBytespublic void writeBytes(byte[] b, int offset, int length) Description copied from class:StreamOutputWrites an array of bytes.- Specified by:
- writeBytesin class- StreamOutput
- Parameters:
- b- the bytes to write
- offset- the offset in the byte array
- length- the number of bytes to write
 
- 
flushpublic void flush()Description copied from class:StreamOutputForces any buffered output to be written.- Specified by:
- flushin interface- Flushable
- Specified by:
- flushin class- StreamOutput
 
- 
closepublic void close()Closes this stream to further operations. This is a no-op, as the underlying BytesRefBuilder has no IO resources.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein class- StreamOutput
 
- 
resetpublic void reset()
- 
ramBytesUsedpublic long ramBytesUsed()- Specified by:
- ramBytesUsedin interface- org.apache.lucene.util.Accountable
 
 
-