Module org.elasticsearch.server
Class CountingStreamOutput
java.lang.Object
java.io.OutputStream
org.elasticsearch.common.io.stream.StreamOutput
org.elasticsearch.common.io.stream.CountingStreamOutput
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
A reusable @link
StreamOutput
that just count how many bytes are written.-
Field Summary
Fields inherited from class org.elasticsearch.common.io.stream.StreamOutput
GENERIC_LIST_HEADER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this stream to further operations.void
flush()
Forces any buffered output to be written.void
reset()
reset the written byes to 0long
size()
returns how many bytes would have been writtenvoid
writeByte
(byte b) Writes a single byte.void
writeBytes
(byte[] b, int offset, int length) Writes an array of bytes.void
writeDouble
(double v) void
writeDoubleArray
(double[] values) void
writeFloat
(float v) void
writeFloatArray
(float[] values) void
writeInt
(int i) Writes an int as four bytes.void
writeIntArray
(int[] values) void
writeLong
(long i) Writes a long as eight bytes.void
writeLongArray
(long[] values) Methods inherited from class org.elasticsearch.common.io.stream.StreamOutput
checkWriteable, getTransportVersion, position, putVInt, setTransportVersion, write, write, writeArray, writeArray, writeBigInteger, writeBoolean, writeByteArray, writeBytes, writeBytes, writeBytesRef, writeBytesReference, writeCollection, writeCollection, writeDoubleLE, writeEnum, writeEnumSet, writeException, writeGenericList, writeGenericMap, writeGenericNull, writeGenericString, writeGenericValue, writeGeoPoint, writeInstant, writeIntLE, writeLongLE, writeMap, writeMap, writeMap, writeMapValues, writeMapValues, writeMapWithConsistentOrder, writeMissingString, writeMissingWriteable, writeNamedWriteable, writeNamedWriteableCollection, writeOptional, writeOptionalArray, writeOptionalArray, writeOptionalBoolean, writeOptionalByteArray, writeOptionalBytesReference, writeOptionalCollection, writeOptionalCollection, writeOptionalDouble, writeOptionalEnum, writeOptionalFloat, writeOptionalFloatArray, 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, writeWriteable, writeZLong, writeZoneId
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
CountingStreamOutput
public CountingStreamOutput()
-
-
Method Details
-
reset
public void reset()reset the written byes to 0 -
size
public long size()returns how many bytes would have been written -
writeByte
public void writeByte(byte b) Description copied from class:StreamOutput
Writes a single byte.- Specified by:
writeByte
in classStreamOutput
-
writeBytes
public void writeBytes(byte[] b, int offset, int length) Description copied from class:StreamOutput
Writes an array of bytes.- Specified by:
writeBytes
in classStreamOutput
- Parameters:
b
- the bytes to writeoffset
- the offset in the byte arraylength
- the number of bytes to write
-
writeInt
public void writeInt(int i) Description copied from class:StreamOutput
Writes an int as four bytes.- Overrides:
writeInt
in classStreamOutput
-
writeIntArray
- Overrides:
writeIntArray
in classStreamOutput
- Throws:
IOException
-
writeLong
public void writeLong(long i) Description copied from class:StreamOutput
Writes a long as eight bytes.- Overrides:
writeLong
in classStreamOutput
-
writeLongArray
- Overrides:
writeLongArray
in classStreamOutput
- Throws:
IOException
-
writeFloat
public void writeFloat(float v) - Overrides:
writeFloat
in classStreamOutput
-
writeFloatArray
- Overrides:
writeFloatArray
in classStreamOutput
- Throws:
IOException
-
writeDouble
public void writeDouble(double v) - Overrides:
writeDouble
in classStreamOutput
-
writeDoubleArray
- Overrides:
writeDoubleArray
in classStreamOutput
- Throws:
IOException
-
flush
public void flush()Description copied from class:StreamOutput
Forces any buffered output to be written.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classStreamOutput
-
close
public void close()Description copied from class:StreamOutput
Closes this stream to further operations.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classStreamOutput
-