Package com.webcodepro.shrinkit.io
Class LittleEndianByteOutputStream
java.lang.Object
java.io.OutputStream
com.webcodepro.shrinkit.io.LittleEndianByteOutputStream
- All Implemented Interfaces:
ByteConstants,Closeable,Flushable,AutoCloseable
An OutputStream with helper methods to write little endian numbers
and other Apple-specific tidbits.
-
Field Summary
Fields inherited from interface com.webcodepro.shrinkit.io.ByteConstants
BXY_ID, NUFILE_ID, NUFX_ID, TIMEREC_DAY, TIMEREC_HOUR, TIMEREC_LENGTH, TIMEREC_MINUTE, TIMEREC_MONTH, TIMEREC_NULL, TIMEREC_SECOND, TIMEREC_WEEKDAY, TIMEREC_YEAR -
Constructor Summary
ConstructorsConstructorDescriptionLittleEndianByteOutputStream(OutputStream outputStream) Construct a LittleEndianByteOutputStream from an OutputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Pass the close request to the wrapped stream.voidflush()Pass the flush request to the wrapped stream.longGet the current CRC-16 value.longAnswer with the total number of bytes written.voidresetCrc()Reset the CRC-16 to $0000.voidwrite(int b) Write a next byte.voidWrite the Java Date object as a TimeRec.voidwriteLong(long l) Write a "Long".voidWrite the NuFile id to the LittleEndianByteOutputStream.voidWrite the NuFX id to the LittleEndianByteOutputStream.voidwriteWord(int w) Write a "Word".Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
Constructor Details
-
LittleEndianByteOutputStream
Construct a LittleEndianByteOutputStream from an OutputStream.
-
-
Method Details
-
write
Write a next byte.- Specified by:
writein classOutputStream- Throws:
IOException
-
writeNuFileId
Write the NuFile id to the LittleEndianByteOutputStream.- Throws:
IOException
-
writeNuFxId
Write the NuFX id to the LittleEndianByteOutputStream.- Throws:
IOException
-
writeWord
Write a "Word".- Throws:
IOException
-
writeLong
Write a "Long".- Throws:
IOException
-
writeDate
Write the Java Date object as a TimeRec. Note that years 2000-2039 are assumed to be 00-39 per the NuFX addendum.- Throws:
IOException- See Also:
-
resetCrc
public void resetCrc()Reset the CRC-16 to $0000. -
getCrcValue
public long getCrcValue()Get the current CRC-16 value. -
getTotalBytesWritten
public long getTotalBytesWritten()Answer with the total number of bytes written. -
flush
Pass the flush request to the wrapped stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
Pass the close request to the wrapped stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-