Module org.hsqldb
Package org.hsqldb.lib

## Class InOutUtil

- java.lang.Object
- - org.hsqldb.lib.InOutUtil

-     public final class InOutUtil
      extends java.lang.Object

  Input / Output utility
  Since:
    1.7.2
  Author:
    Fred Toussi (fredt@users dot sourceforge.net), Campbell Burnet (campbell-burnet@users dot sourceforge.net)

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `DEFAULT_COPY_AMOUNT` |
    `static int` | `DEFAULT_COPY_BUFFER_SIZE` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static long` | `copy​(java.io.InputStream inputStream, java.io.OutputStream outputStream)` |
    `static long` | `copy​(java.io.InputStream inputStream, java.io.OutputStream outputStream, long amount)` |
    `static long` | `copy​(java.io.InputStream inputStream, java.io.OutputStream outputStream, long amount, int bufferSize)` | the specified `amount` from the given input stream to the given output stream, using a buffer of the given size.
    `static long` | `copy​(java.io.Reader reader, java.io.Writer writer)` |
    `static long` | `copy​(java.io.Reader reader, java.io.Writer writer, long amount)` |
    `static long` | `copy​(java.io.Reader reader, java.io.Writer writer, long amount, int bufferSize)` | the specified `amount` from the given input stream to the given output stream, using a buffer of the given size.
    `static java.io.Serializable` | `deserialize​(byte[] ba)` | Deserializes the specified byte array to an `Object` instance.
    `static int` | `readLine​(java.io.InputStream in, java.io.OutputStream out)` | Implementation only supports unix line-end format and is suitable for processing HTTP and other network protocol communications.
    `static byte[]` | `serialize​(java.io.Serializable s)` | Retrieves the serialized form of the specified `Object` as an array of bytes.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_COPY_BUFFER_SIZE

          public static final int DEFAULT_COPY_BUFFER_SIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_COPY_AMOUNT

          public static final long DEFAULT_COPY_AMOUNT

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### readLine

          public static int readLine​(java.io.InputStream in,
                                     java.io.OutputStream out)
                              throws java.io.IOException

      Implementation only supports unix line-end format and is suitable for processing HTTP and other network protocol communications. Reads and writes a line of data. Returns the number of bytes read/written.
      Parameters:
        `in` - InputStream
        `out` - OutputStream
      Returns:
        int
      Throws:
        `java.io.IOException` - on failure

    - #### serialize

          public static byte[] serialize​(java.io.Serializable s)
                                  throws java.io.IOException

      Retrieves the serialized form of the specified `Object` as an array of bytes.
      Parameters:
        `s` - the Object to serialize
      Returns:
        a static byte array representing the passed Object
      Throws:
        `java.io.IOException` - on failure

    - #### deserialize

          public static java.io.Serializable deserialize​(byte[] ba)
                                                  throws java.io.IOException,
                                                         java.lang.ClassNotFoundException

      Deserializes the specified byte array to an `Object` instance.
      Parameters:
        `ba` - the byte array to deserialize to an Object
      Returns:
        the Object resulting from deserializing the specified array of bytes
      Throws:
        `java.io.IOException` - on failure
        `java.lang.ClassNotFoundException` - if not found

    - #### copy

          public static long copy​(java.io.InputStream inputStream,
                                  java.io.OutputStream outputStream)
                           throws java.io.IOException

      Parameters:
        `inputStream` - InputStream
        `outputStream` - OutputStream
      Returns:
        long
      Throws:
        `java.io.IOException` - on failure
      See Also:
        `copy(java.io.InputStream, java.io.OutputStream, long, int)`

    - #### copy

          public static long copy​(java.io.InputStream inputStream,
                                  java.io.OutputStream outputStream,
                                  long amount)
                           throws java.io.IOException

      Parameters:
        `inputStream` - InputStream
        `outputStream` - OutputStream
        `amount` - long
      Returns:
        long
      Throws:
        `java.io.IOException` - on failure
      See Also:
        `copy(java.io.InputStream, java.io.OutputStream, long, int)`

    - #### copy

          public static long copy​(java.io.InputStream inputStream,
                                  java.io.OutputStream outputStream,
                                  long amount,
                                  int bufferSize)
                           throws java.io.IOException

      the specified `amount` from the given input stream to the given output stream, using a buffer of the given size.
      Parameters:
        `inputStream` - from which to source bytes
        `outputStream` - to which to sink bytes
        `amount` - max # of bytes to transfer.
        `bufferSize` - to use internally
      Returns:
        the number of bytes actually transferred.
      Throws:
        `java.io.IOException` - if any, thrown by either of the given stream objects

    - #### copy

          public static long copy​(java.io.Reader reader,
                                  java.io.Writer writer)
                           throws java.io.IOException

      Parameters:
        `reader` - Reader
        `writer` - Writer
      Returns:
        long
      Throws:
        `java.io.IOException` - on failure
      See Also:
        `copy(java.io.Reader, java.io.Writer, long, int)`

    - #### copy

          public static long copy​(java.io.Reader reader,
                                  java.io.Writer writer,
                                  long amount)
                           throws java.io.IOException

      Parameters:
        `reader` - Reader
        `writer` - Writer
        `amount` - long
      Returns:
        long
      Throws:
        `java.io.IOException` - on failure
      See Also:
        `copy(java.io.Reader, java.io.Writer, long, int)`

    - #### copy

          public static long copy​(java.io.Reader reader,
                                  java.io.Writer writer,
                                  long amount,
                                  int bufferSize)
                           throws java.io.IOException

      the specified `amount` from the given input stream to the given output stream, using a buffer of the given size.
      Parameters:
        `reader` - from which to source characters
        `writer` - to which to sink characters
        `amount` - max # of characters to transfer.
        `bufferSize` - to use internally
      Returns:
        the number of characters actually transferred.
      Throws:
        `java.io.IOException` - if any, thrown by either of the given stream objects