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
Modifier and TypeFieldDescriptionstatic final int
The maximum value of int that can be written viawriteCompressedInt(int)
orwriteCompressedInt(int, java.io.OutputStream)
.static final int
The minimum value of int that can be written viawriteCompressedInt(int)
orwriteCompressedInt(int, java.io.OutputStream)
.Fields inherited from class java.io.DataOutputStream
written
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkCompressedInt
(int i) Verifies a value is in the acceptable range for a compressed int.boolean
void
writeCompressedInt
(int i) static void
writeCompressedInt
(int i, OutputStream out) void
writeCompressedUTF
(String str) void
writeCompressedUTF
(String str, int slot) Writes a String to the stream while using prefix compression.void
Writes anEnum
, represented by itsEnum.name()
.void
writeLongUTF
(String str) Writes a string of any length.void
void
void
writeNullEnum
(Enum<?> e) void
void
void
writeNullLongUTF
(String str) Writes a string of any length, supportingnull
.void
void
writeNullUTF
(String str) Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
Methods inherited from class java.io.FilterOutputStream
close, write
Methods inherited from class java.io.OutputStream
nullOutputStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
-