Class 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.
    • Constructor Detail

      • LittleEndianByteOutputStream

        public LittleEndianByteOutputStream​(java.io.OutputStream outputStream)
        Construct a LittleEndianByteOutputStream from an OutputStream.
    • Method Detail

      • write

        public void write​(int b)
                   throws java.io.IOException
        Write a next byte.
        Specified by:
        write in class java.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 interface java.io.Flushable
        Overrides:
        flush in class java.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 interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException