Class HorizontalDifferencingStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    final class HorizontalDifferencingStream
    extends java.io.OutputStream
    A decoder for data converted using "horizontal differencing predictor".
    Version:
    $Id: HorizontalDeDifferencingStream.java,v 1.0 11.03.13 14:20 haraldk Exp$
    • Constructor Summary

      Constructors 
      Constructor Description
      HorizontalDifferencingStream​(java.io.OutputStream stream, int columns, int samplesPerPixel, int bitsPerSample, java.nio.ByteOrder byteOrder)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      private void encodeRow()  
      void flush()  
      private boolean flushBuffer()  
      (package private) static boolean isValidBPS​(int bitsPerSample)  
      void write​(byte[] b, int off, int len)  
      void write​(int b)  
      • Methods inherited from class java.io.OutputStream

        nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • columns

        private final int columns
      • samplesPerPixel

        private final int samplesPerPixel
      • bitsPerSample

        private final int bitsPerSample
      • channel

        private final java.nio.channels.WritableByteChannel channel
      • buffer

        private final java.nio.ByteBuffer buffer
    • Constructor Detail

      • HorizontalDifferencingStream

        public HorizontalDifferencingStream​(java.io.OutputStream stream,
                                            int columns,
                                            int samplesPerPixel,
                                            int bitsPerSample,
                                            java.nio.ByteOrder byteOrder)
    • Method Detail

      • isValidBPS

        static boolean isValidBPS​(int bitsPerSample)
      • flushBuffer

        private boolean flushBuffer()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • encodeRow

        private void encodeRow()
                        throws java.io.EOFException
        Throws:
        java.io.EOFException
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        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
        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