Package com.webcodepro.shrinkit.io
Class LittleEndianByteOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.webcodepro.shrinkit.io.LittleEndianByteOutputStream
-
- All Implemented Interfaces:
ByteConstants
,java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class LittleEndianByteOutputStream extends java.io.OutputStream implements ByteConstants
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
Constructors Constructor Description LittleEndianByteOutputStream(java.io.OutputStream outputStream)
Construct a LittleEndianByteOutputStream from an OutputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Pass the close request to the wrapped stream.void
flush()
Pass the flush request to the wrapped stream.long
getCrcValue()
Get the current CRC-16 value.long
getTotalBytesWritten()
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
writeDate(java.util.Date date)
Write the Java Date object as a TimeRec.void
writeLong(long l)
Write a "Long".void
writeNuFileId()
Write the NuFile id to the LittleEndianByteOutputStream.void
writeNuFxId()
Write the NuFX id to the LittleEndianByteOutputStream.void
writeWord(int w)
Write a "Word".
-
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
Write a next byte.- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
writeNuFileId
public void writeNuFileId() throws java.io.IOException
Write the NuFile id to the LittleEndianByteOutputStream.- Throws:
java.io.IOException
-
writeNuFxId
public void writeNuFxId() throws java.io.IOException
Write the NuFX id to the LittleEndianByteOutputStream.- Throws:
java.io.IOException
-
writeWord
public void writeWord(int w) throws java.io.IOException
Write a "Word".- Throws:
java.io.IOException
-
writeLong
public void writeLong(long l) throws java.io.IOException
Write a "Long".- Throws:
java.io.IOException
-
writeDate
public void writeDate(java.util.Date date) throws java.io.IOException
Write the Java Date object as a TimeRec. Note that years 2000-2039 are assumed to be 00-39 per the NuFX addendum.- Throws:
java.io.IOException
- See Also:
- NuFX addendum
-
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
public void flush() throws java.io.IOException
Pass the flush request to the wrapped stream.- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
Pass the close request to the wrapped stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
-