Object
de.sayayi.lib.pack.PackOutputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionPackOutputStream(boolean compress, @NotNull OutputStream stream) PackOutputStream(@NotNull PackConfig packConfig, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int version, boolean compress, @NotNull OutputStream stream) PackOutputStream(@NotNull PackConfig packConfig, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int version, @NotNull OutputStream stream) PackOutputStream(@NotNull PackConfig packConfig, boolean compress, @NotNull OutputStream stream) PackOutputStream(@NotNull PackConfig packConfig, @NotNull OutputStream stream) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidvoidwriteBoolean(boolean value) Write a boolean value to the output stream.<T extends Enum<T>>
voidwriteEnum(T value) Write an enumerated value to the output stream.<T extends Enum<T>>
voidwriteEnum(T value, @org.jetbrains.annotations.Range(from=1L, to=16L) int bitWidth) Write an enumerated value to the output stream.voidwriteInt(int value) voidwriteLarge(long value, @org.jetbrains.annotations.Range(from=9L, to=64L) int bitWidth) voidwriteLong(long value) voidwriteSmall(@org.jetbrains.annotations.Range(from=0L, to=255L) int value, @org.jetbrains.annotations.Range(from=1L, to=8L) int bitWidth) voidwriteSmallVar(@org.jetbrains.annotations.Range(from=0L, to=255L) int value) Ranges: 0..7 (4 bit), 8..15 (5 bit), 16..255 (10 bit)voidwriteString(String string) voidwriteUnsignedShort(@org.jetbrains.annotations.Range(from=0L, to=65535L) int value)
-
Constructor Details
-
PackOutputStream
@Contract(mutates="param2,io") public PackOutputStream(boolean compress, @NotNull @NotNull OutputStream stream) throws IOException - Throws:
IOException- Since:
- 0.1.2
-
PackOutputStream
@Contract(mutates="param3,io") public PackOutputStream(@NotNull @NotNull PackConfig packConfig, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int version, @NotNull @NotNull OutputStream stream) throws IOException - Throws:
IOException
-
PackOutputStream
@Contract(mutates="param2,io") public PackOutputStream(@NotNull @NotNull PackConfig packConfig, @NotNull @NotNull OutputStream stream) throws IOException - Throws:
IOException
-
PackOutputStream
@Contract(mutates="param3,io") public PackOutputStream(@NotNull @NotNull PackConfig packConfig, boolean compress, @NotNull @NotNull OutputStream stream) throws IOException - Throws:
IOException
-
PackOutputStream
@Contract(mutates="param4,io") public PackOutputStream(@NotNull @NotNull PackConfig packConfig, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int version, boolean compress, @NotNull @NotNull OutputStream stream) throws IOException - Throws:
IOException
-
-
Method Details
-
writeBoolean
Write a boolean value to the output stream.- Parameters:
value- boolean value to write- Throws:
IOException- if an I/O error occurs
-
writeEnum
@Contract(mutates="this,io") public <T extends Enum<T>> void writeEnum(@NotNull T value, @org.jetbrains.annotations.Range(from=1L, to=16L) int bitWidth) throws IOException Write an enumerated value to the output stream.- Parameters:
value- enumerated value to write, notnullbitWidth- number of bits to use for the enumerated value- Throws:
IllegalArgumentException- ifbitWidthis not in the range 1..16 or if the ordinal of the enumerated value exceeds thebitWidthIOException- if an I/O error occurs
-
writeEnum
@Contract(mutates="this,io") public <T extends Enum<T>> void writeEnum(@NotNull T value) throws IOException Write an enumerated value to the output stream.- Parameters:
value- enumerated value to write, notnull- Throws:
IOException- if an I/O error occurs
-
writeUnsignedShort
@Contract(mutates="this,io") public void writeUnsignedShort(@org.jetbrains.annotations.Range(from=0L, to=65535L) int value) throws IOException - Parameters:
value- unsigned value (0..65535)- Throws:
IOException- if an I/O error occurs
-
writeInt
- Throws:
IOException
-
writeLong
- Throws:
IOException
-
writeString
- Throws:
IOException
-
writeSmallVar
@Contract(mutates="this,io") public void writeSmallVar(@org.jetbrains.annotations.Range(from=0L, to=255L) int value) throws IOException Ranges: 0..7 (4 bit), 8..15 (5 bit), 16..255 (10 bit)- Parameters:
value- unsigned value (0..255)- Throws:
IOException- if an I/O error occurs
-
writeSmall
@Contract(mutates="this,io") public void writeSmall(@org.jetbrains.annotations.Range(from=0L, to=255L) int value, @org.jetbrains.annotations.Range(from=1L, to=8L) int bitWidth) throws IOException - Parameters:
value- unsigned value (0..255)bitWidth- range 1..8 bits- Throws:
IOException- if an I/O error occurs
-
writeLarge
@Contract(mutates="this,io") public void writeLarge(long value, @org.jetbrains.annotations.Range(from=9L, to=64L) int bitWidth) throws IOException - Parameters:
value- signed valuebitWidth- range 9..64 bits- Throws:
IOException- if an I/O error occurs
-
forceByteAlignment
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-