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 TypeMethodDescriptionvoidclose()Closes this stream to further operations.voidflush()Forces any buffered output to be written.voidreset()reset the written byes to 0longsize()returns how many bytes would have been writtenvoidwriteByte(byte b) Writes a single byte.voidwriteBytes(byte[] b, int offset, int length) Writes an array of bytes.voidwriteDouble(double v) voidwriteDoubleArray(double[] values) voidwriteFloat(float v) voidwriteFloatArray(float[] values) voidwriteInt(int i) Writes an int as four bytes.voidwriteIntArray(int[] values) voidwriteLong(long i) Writes a long as eight bytes.voidwriteLongArray(long[] values) Methods inherited from class org.elasticsearch.common.io.stream.StreamOutput
checkWriteable, getTransportVersion, legacyWriteWithSizePrefix, 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, writeZoneIdMethods 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:StreamOutputWrites a single byte.- Specified by:
writeBytein classStreamOutput
-
writeBytes
public void writeBytes(byte[] b, int offset, int length) 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
-
writeInt
public void writeInt(int i) Description copied from class:StreamOutputWrites an int as four bytes.- Overrides:
writeIntin classStreamOutput
-
writeIntArray
- Overrides:
writeIntArrayin classStreamOutput- Throws:
IOException
-
writeLong
public void writeLong(long i) Description copied from class:StreamOutputWrites a long as eight bytes.- Overrides:
writeLongin classStreamOutput
-
writeLongArray
- Overrides:
writeLongArrayin classStreamOutput- Throws:
IOException
-
writeFloat
public void writeFloat(float v) - Overrides:
writeFloatin classStreamOutput
-
writeFloatArray
- Overrides:
writeFloatArrayin classStreamOutput- Throws:
IOException
-
writeDouble
public void writeDouble(double v) - Overrides:
writeDoublein classStreamOutput
-
writeDoubleArray
- Overrides:
writeDoubleArrayin classStreamOutput- Throws:
IOException
-
flush
public void flush()Description copied from class:StreamOutputForces any buffered output to be written.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classStreamOutput
-
close
public void close()Description copied from class:StreamOutputCloses this stream to further operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classStreamOutput
-