java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.DataOutputStream
com.aoapps.hodgepodge.io.stream.StreamableOutput
- All Implemented Interfaces:
NoClose,Closeable,DataOutput,Flushable,AutoCloseable
Adds compressed data transfer to DataOutputStream. This class is not
thread safe.
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum value of int that can be written viawriteCompressedInt(int)orwriteCompressedInt(int, java.io.OutputStream).static final intThe minimum value of int that can be written viawriteCompressedInt(int)orwriteCompressedInt(int, java.io.OutputStream).Fields inherited from class java.io.DataOutputStream
writtenFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCompressedInt(int i) Verifies a value is in the acceptable range for a compressed int.booleanvoidwriteCompressedInt(int i) static voidwriteCompressedInt(int i, OutputStream out) voidwriteCompressedUTF(String str) voidwriteCompressedUTF(String str, int slot) Writes a String to the stream while using prefix compression.voidWrites anEnum, represented by itsEnum.name().voidwriteLongUTF(String str) Writes a string of any length.voidvoidvoidwriteNullEnum(Enum<?> e) voidvoidvoidwriteNullLongUTF(String str) Writes a string of any length, supportingnull.voidvoidwriteNullUTF(String str) Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFMethods inherited from class java.io.FilterOutputStream
close, writeMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.DataOutput
write
-
Field Details
-
MIN_COMPRESSED_INT_VALUE
public static final int MIN_COMPRESSED_INT_VALUEThe minimum value of int that can be written viawriteCompressedInt(int)orwriteCompressedInt(int, java.io.OutputStream).- See Also:
-
MAX_COMPRESSED_INT_VALUE
public static final int MAX_COMPRESSED_INT_VALUEThe maximum value of int that can be written viawriteCompressedInt(int)orwriteCompressedInt(int, java.io.OutputStream).- See Also:
-
-
Constructor Details
-
StreamableOutput
-
-
Method Details
-
isNoClose
public boolean isNoClose() -
checkCompressedInt
Verifies a value is in the acceptable range for a compressed int.- Throws:
IOException- See Also:
-
writeCompressedInt
- Throws:
IOException- See Also:
-
writeCompressedInt
- Throws:
IOException
-
writeCompressedUTF
Writes a String to the stream while using prefix compression.The first byte has these bits: X X X X X X X X | | +-+-+-+-+-+ Slot number (0-63) | +------------ 1 = Suffix UTF follows, 0 = No suffix UTF exists +-------------- 1 = Common length difference follows, 0 = Common length not changed Second, if common length difference is not zero, the common length change follows one less for positive differences because 0 is handled in first byte Third, if suffix UTF follows, writeUTF of all the string after common length- Throws:
IOException
-
writeCompressedUTF
- Throws:
IOException
-
writeNullUTF
- Throws:
IOException
-
writeLongUTF
Writes a string of any length.- Throws:
IOException
-
writeNullLongUTF
Writes a string of any length, supportingnull.- Throws:
IOException
-
writeNullByte
- Throws:
IOException
-
writeNullShort
- Throws:
IOException
-
writeNullInteger
- Throws:
IOException
-
writeNullLong
- Throws:
IOException
-
writeEnum
Writes anEnum, represented by itsEnum.name().- Throws:
IOException
-
writeNullEnum
- Throws:
IOException
-
writeNullBoolean
- Throws:
IOException
-
