Class IO


  • public final class IO
    extends java.lang.Object
    Contains static utility functions for working with both IO classes.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compareInputByteStreams​(InputByteStream stream1, InputByteStream stream2)
      Compare two InputByteStream instances on a byte for byte basis.
      static long copy​(BitInputStream is, long length, java.io.OutputStream os, int bitsPerValue)
      Copies length number of samples each with bits "bitsPerValue" from BitInputStream to the outputstream.
      static long copy​(BitInputStream is, java.io.OutputStream os, int bitsPerValue)
      Only for internal engineering use.
      static long copy​(InputByteStream is, long offset, long length, OutputByteStream os)
      Only for internal engineering use.
      static long copy​(InputByteStream is, long offset, long length, java.io.OutputStream os)
      Only for internal engineering use.
      static long copy​(InputByteStream is, long offset, long length, java.io.OutputStream os, int blockSize)
      Only for internal engineering use.
      static long copy​(InputByteStream is, OutputByteStream os)
      Only for internal engineering use.
      static long copy​(InputByteStream is, java.io.OutputStream os)
      Only for internal engineering use.
      static long copy​(java.io.InputStream is, long length, java.io.OutputStream os)
      Only for internal engineering use.
      static long copy​(java.io.InputStream is, OutputByteStream obs)
      Only for internal engineering use.
      static long copy​(java.io.InputStream is, java.io.OutputStream os)
      Only for internal engineering use.
      static byte[] inputByteStreamToArray​(InputByteStream byteStream)
      Only for internal engineering use.
      static byte[] longToByteArray​(long value, int width)
      Only for internal engineering use.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • copy

        public static final long copy​(java.io.InputStream is,
                                      java.io.OutputStream os)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies the source InputStream to the destination OuputStream.
        Parameters:
        is - InputStream to be copied
        os - OutputSream to copy to
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(java.io.InputStream is,
                                      long length,
                                      java.io.OutputStream os)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies length number of bytes from the InputStream to the destination OuputStream.
        Parameters:
        is - InputByteStream to be copied
        length - The amount of bytes to be copies
        os - OutputTream to copy to
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(BitInputStream is,
                                      java.io.OutputStream os,
                                      int bitsPerValue)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Parses the passed BitInputStream based on bitsPerValue and fills destination OuputStream with the parsed values.
        Parameters:
        is - BitInputStream to be copied
        os - OutputSream to copy to
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(BitInputStream is,
                                      long length,
                                      java.io.OutputStream os,
                                      int bitsPerValue)
                               throws java.io.IOException
        Copies length number of samples each with bits "bitsPerValue" from BitInputStream to the outputstream.
        Parameters:
        is -
        length -
        os -
        bitsPerValue -
        Returns:
        long Number of samples actually read.
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(InputByteStream is,
                                      OutputByteStream os)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies the source InputStream to the destination OuputStream.
        Parameters:
        is - InputStream to be copied
        os - OutputTream to copy to
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(InputByteStream is,
                                      java.io.OutputStream os)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies the source InputStream to the destination OuputStream.
        Parameters:
        is - InputStream to be copied
        os - OutputTream to copy to
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(InputByteStream is,
                                      long offset,
                                      long length,
                                      OutputByteStream os)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies bytes from the InputByteStream to the destination OuputStream.
        Parameters:
        is - InputByteStream to be copied
        offset - The offset into the InputByteStream where the copy should begin
        length - The amount of bytes to be copies
        os - OutputTream to copy to
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(InputByteStream is,
                                      long offset,
                                      long length,
                                      java.io.OutputStream os,
                                      int blockSize)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies bytes from the InputByteStream to the destination OuputStream.
        Parameters:
        is - InputByteStream to be copied
        offset - The offset into the InputByteStream where the copy should begin
        length - The amount of bytes to be copied
        os - OutputStream to copy to
        blockSize - size of the block to use in copying
        Throws:
        java.io.IOException
      • copy

        public static final long copy​(InputByteStream is,
                                      long offset,
                                      long length,
                                      java.io.OutputStream os)
                               throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies bytes from the InputByteStream to the destination OuputStream.
        Parameters:
        is - InputByteStream to be copied
        offset - The offset into the InputByteStream where the copy should begin
        length - The amount of bytes to be copies
        os - OutputTream to copy to
        Throws:
        java.io.IOException
      • longToByteArray

        public static final byte[] longToByteArray​(long value,
                                                   int width)
        Only for internal engineering use. This api can change without notice. This utility method converts an long to a byte array
        Parameters:
        value - - long value to be written
        width - - int number of bytes to be written
      • inputByteStreamToArray

        public static final byte[] inputByteStreamToArray​(InputByteStream byteStream)
                                                   throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Obtains the InputByteStream's content as a byte array. Generally it is a bad idea to copy the whole stream's content into memory but for the text streams this is the only way to convert the text stream's content to Unicode from PDFDocEncoding or UCS-2.
        Returns:
        byte array in memory that contains the complete byte sequence in the stream.
        Throws:
        java.io.IOException
      • copy

        public static long copy​(java.io.InputStream is,
                                OutputByteStream obs)
                         throws java.io.IOException
        Only for internal engineering use. This api can change without notice. Copies the source InputStream to the destination OuputStream.
        Parameters:
        is - InputStream to be copied
        obs - OutputByteSream to copy to
        Throws:
        java.io.IOException
      • compareInputByteStreams

        public static int compareInputByteStreams​(InputByteStream stream1,
                                                  InputByteStream stream2)
                                           throws java.io.IOException
        Compare two InputByteStream instances on a byte for byte basis. This compares the two streams from their current positions until the end of the streams. When this method returns the position of the streams will be just beyond the point of failure. The comparison is on a byte level and the "lesser" stream is the one whose byte value at given position is of lower numeric value than the other stream or the stream which is shorter.
        Parameters:
        stream1 -
        stream2 -
        Returns:
        0 if the streams are equal; negative if stream1 is "less" than stream2; and positive if stream1 is "greater" than stream2
        Throws:
        java.io.IOException