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 TypeMethodDescriptionvoid
close()
Pass the close request to the wrapped stream.void
flush()
Pass the flush request to the wrapped stream.long
Get the current CRC-16 value.long
Answer with the total number of bytes written.void
resetCrc()
Reset the CRC-16 to $0000.void
write
(int b) Write a next byte.void
Write the Java Date object as a TimeRec.void
writeLong
(long l) Write a "Long".void
Write the NuFile id to the LittleEndianByteOutputStream.void
Write the NuFX id to the LittleEndianByteOutputStream.void
writeWord
(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:
write
in 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:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
Pass the close request to the wrapped stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-