Module org.elasticsearch.server
Class OutputStreamStreamOutput
java.lang.Object
java.io.OutputStream
org.elasticsearch.common.io.stream.StreamOutput
org.elasticsearch.common.io.stream.OutputStreamStreamOutput
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
-
Field Summary
Fields inherited from class org.elasticsearch.common.io.stream.StreamOutput
GENERIC_LIST_HEADER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this stream to further operations.voidflush()Forces any buffered output to be written.longposition()voidwriteByte(byte b) Writes a single byte.voidwriteBytes(byte[] b, int offset, int length) Writes an array of bytes.voidwriteGenericString(String value) Write aStringwithinStreamOutput.writeGenericValue(java.lang.Object), represented as the type code byte0followed by the string itself written as if withStreamOutput.writeString(java.lang.String).voidWrite a possibly-nullString, represented as awhich isinvalid reference
booleanfalseif the string is null, or elsetrueif it is not null, and in this latter case it is followed by the string itself written as if withStreamOutput.writeString(java.lang.String).voidwriteString(String str) Write aString: its length in Unicode code units (chars) (NB not bytes) written usingStreamOutput.writeVInt(int)followed by the sequence of characters themselves encoded as UTF-8.Methods inherited from class org.elasticsearch.common.io.stream.StreamOutput
checkWriteable, getTransportVersion, legacyWriteWithSizePrefix, setTransportVersion, write, write, writeArray, writeArray, writeBigInteger, writeBoolean, writeByteArray, writeBytes, writeBytes, writeBytesRef, writeBytesReference, writeCollection, writeCollection, writeDouble, writeDoubleArray, writeDoubleLE, writeEnum, writeEnumSet, writeException, writeFloat, writeFloatArray, writeGenericList, writeGenericMap, writeGenericNull, writeGenericValue, writeGeoPoint, writeInstant, writeInt, writeIntArray, writeIntLE, writeLong, writeLongArray, writeLongLE, writeMap, writeMap, writeMap, writeMapValues, writeMapValues, writeMapWithConsistentOrder, writeMissingString, writeMissingWriteable, writeNamedWriteable, writeNamedWriteableCollection, writeOptional, writeOptionalArray, writeOptionalArray, writeOptionalBoolean, writeOptionalByteArray, writeOptionalBytesReference, writeOptionalCollection, writeOptionalCollection, writeOptionalDouble, writeOptionalEnum, writeOptionalException, writeOptionalFloat, writeOptionalFloatArray, writeOptionalInstant, writeOptionalInt, writeOptionalLong, writeOptionalMap, writeOptionalNamedWriteable, writeOptionalNamedWriteableCollection, writeOptionalSecureString, writeOptionalStringArray, writeOptionalStringCollection, writeOptionalText, writeOptionalTimeValue, writeOptionalVInt, writeOptionalVLong, writeOptionalWriteable, writeOptionalZoneId, writeSecureString, writeShort, writeStringArray, writeStringArrayNullable, writeStringCollection, writeText, writeTimeValue, writeVInt, writeVIntArray, writeVLong, writeVLongArray, writeWithSizePrefix, writeWriteable, writeZLong, writeZoneIdMethods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
OutputStreamStreamOutput
-
-
Method Details
-
writeByte
Description copied from class:StreamOutputWrites a single byte.- Specified by:
writeBytein classStreamOutput- Throws:
IOException
-
writeBytes
Description copied from class:StreamOutputWrites an array of bytes.- Specified by:
writeBytesin classStreamOutput- Parameters:
b- the bytes to writeoffset- the offset in the byte arraylength- the number of bytes to write- Throws:
IOException
-
position
public long position()- Specified by:
positionin classStreamOutput- Returns:
- the current position of the stream, in bytes. Increases as data is written to the stream. If the stream is seekable then
the seek operation updates the current
position().
-
writeString
Description copied from class:StreamOutputWrite aString: its length in Unicode code units (chars) (NB not bytes) written usingStreamOutput.writeVInt(int)followed by the sequence of characters themselves encoded as UTF-8.May be performance-critical, so subclasses must specify an explicit implementation. If performance is unimportant, consider using
StreamOutputHelper.writeString(java.lang.String, java.io.OutputStream).- Specified by:
writeStringin classStreamOutput- Throws:
IOException
-
writeOptionalString
Description copied from class:StreamOutputWrite a possibly-nullString, represented as awhich isinvalid reference
booleanfalseif the string is null, or elsetrueif it is not null, and in this latter case it is followed by the string itself written as if withStreamOutput.writeString(java.lang.String).May be performance-critical, so subclasses must specify an explicit implementation. If performance is unimportant, consider using
StreamOutputHelper.writeOptionalString(java.lang.String, java.io.OutputStream).- Specified by:
writeOptionalStringin classStreamOutput- Throws:
IOException
-
writeGenericString
Description copied from class:StreamOutputWrite aStringwithinStreamOutput.writeGenericValue(java.lang.Object), represented as the type code byte0followed by the string itself written as if withStreamOutput.writeString(java.lang.String).May be performance-critical, so subclasses must specify an explicit implementation. If performance is unimportant, consider using
StreamOutputHelper.writeGenericString(java.lang.String, java.io.OutputStream).- Specified by:
writeGenericStringin classStreamOutput- Throws:
IOException
-
flush
Description copied from class:StreamOutputForces any buffered output to be written.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classStreamOutput- Throws:
IOException
-
close
Description copied from class:StreamOutputCloses this stream to further operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classStreamOutput- Throws:
IOException
-