Class BEByteArrayOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, jj2000.j2k.fileformat.FileFormatBoxes

    public class BEByteArrayOutputStream
    extends java.io.ByteArrayOutputStream
    implements jj2000.j2k.fileformat.FileFormatBoxes
    Big Endian Output Array Stream, works as a replacement for FileFormatWriter at the output of Jpeg2K encoder.
    Author:
    Dzung Nguyen
    See Also:
    ByteArrayOutputStream, FileFormatBoxes
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int clength
      Length of codestream
      private static int CSB_LENGTH
      Length of Colour Specification Box
      private static int FTB_LENGTH
      Length of File Type Box
      private int height
      Image height
      private static int IHB_LENGTH
      Length of Image Header Box
      private int width
      Image width
      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
      • Fields inherited from interface jj2000.j2k.fileformat.FileFormatBoxes

        BITS_PER_COMPONENT_BOX, CAPTURE_RESOLUTION_BOX, CHANNEL_DEFINITION_BOX, COLOUR_SPECIFICATION_BOX, COMPONENT_MAPPING_BOX, CONTIGUOUS_CODESTREAM_BOX, CSB_APPROX, CSB_ENUM_GREY, CSB_ENUM_SRGB, CSB_METH, CSB_PREC, DEFAULT_DISPLAY_RESOLUTION_BOX, FILE_TYPE_BOX, FT_BR, IMAGE_HEADER_BOX, IMB_C, IMB_IPR, IMB_UnkC, IMB_VERS, INTELLECTUAL_PROPERTY_BOX, JP2_HEADER_BOX, JP2_SIGNATURE_BOX, PALETTE_BOX, RESOLUTION_BOX, URL_BOX, UUID_BOX, UUID_INFO_BOX, UUID_LIST_BOX, XML_BOX
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void writeColourSpecificationBox()
      This method writes the Colour Specification box
      void writeContiguousCodeStreamBox​(byte[] cs)
      This method writes the Contiguous codestream box
      int writeFileFormat()
      This method reads the codestream and writes the file format wrapper and the codestream to the same file
      void writeFileTypeBox()
      This method writes the File Type box
      void writeImageHeaderBox()
      This method writes the Image Header box
      void writeInt​(int b)  
      void writeJP2HeaderBox()
      This method writes the JP2Header box
      void writeShortInt​(int b)  
      • Methods inherited from class java.io.ByteArrayOutputStream

        close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
      • Methods inherited from class java.io.OutputStream

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

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

      • height

        private int height
        Image height
      • width

        private int width
        Image width
      • clength

        private int clength
        Length of codestream
      • CSB_LENGTH

        private static final int CSB_LENGTH
        Length of Colour Specification Box
        See Also:
        Constant Field Values
      • FTB_LENGTH

        private static final int FTB_LENGTH
        Length of File Type Box
        See Also:
        Constant Field Values
      • IHB_LENGTH

        private static final int IHB_LENGTH
        Length of Image Header Box
        See Also:
        Constant Field Values
    • Constructor Detail

      • BEByteArrayOutputStream

        public BEByteArrayOutputStream()
      • BEByteArrayOutputStream

        public BEByteArrayOutputStream​(java.io.ByteArrayOutputStream bs,
                                       int w,
                                       int h)
                                throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • writeInt

        public void writeInt​(int b)
      • writeShortInt

        public void writeShortInt​(int b)
      • writeFileFormat

        public int writeFileFormat()
                            throws java.io.IOException
        This method reads the codestream and writes the file format wrapper and the codestream to the same file
        Returns:
        The number of bytes increases because of the file format
        Throws:
        java.io.IOException - If an I/O error ocurred.
      • writeFileTypeBox

        public void writeFileTypeBox()
                              throws java.io.IOException
        This method writes the File Type box
        Throws:
        java.io.IOException - If an I/O error ocurred.
      • writeJP2HeaderBox

        public void writeJP2HeaderBox()
                               throws java.io.IOException
        This method writes the JP2Header box
        Throws:
        java.io.IOException - If an I/O error ocurred.
      • writeColourSpecificationBox

        public void writeColourSpecificationBox()
                                         throws java.io.IOException
        This method writes the Colour Specification box
        Throws:
        java.io.IOException - If an I/O error ocurred.
      • writeImageHeaderBox

        public void writeImageHeaderBox()
                                 throws java.io.IOException
        This method writes the Image Header box
        Throws:
        java.io.IOException - If an I/O error ocurred.
      • writeContiguousCodeStreamBox

        public void writeContiguousCodeStreamBox​(byte[] cs)
                                          throws java.io.IOException
        This method writes the Contiguous codestream box
        Parameters:
        cs - The contiguous codestream
        Throws:
        java.io.IOException - If an I/O error ocurred.