Module org.hsqldb

Class InOutUtil

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

public final class InOutUtil extends 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 Details

  • Method Details

    • readLine

      public static int readLine(InputStream in, OutputStream out) throws 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:
      IOException - on failure
    • serialize

      public static byte[] serialize(Serializable s) throws 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:
      IOException - on failure
    • deserialize

      public static Serializable deserialize(byte[] ba) throws IOException, 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:
      IOException - on failure
      ClassNotFoundException - if not found
    • copy

      public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException
      Parameters:
      inputStream - InputStream
      outputStream - OutputStream
      Returns:
      long
      Throws:
      IOException - on failure
      See Also:
    • copy

      public static long copy(InputStream inputStream, OutputStream outputStream, long amount) throws IOException
      Parameters:
      inputStream - InputStream
      outputStream - OutputStream
      amount - long
      Returns:
      long
      Throws:
      IOException - on failure
      See Also:
    • copy

      public static long copy(InputStream inputStream, OutputStream outputStream, long amount, int bufferSize) throws 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:
      IOException - if any, thrown by either of the given stream objects
    • copy

      public static long copy(Reader reader, Writer writer) throws IOException
      Parameters:
      reader - Reader
      writer - Writer
      Returns:
      long
      Throws:
      IOException - on failure
      See Also:
    • copy

      public static long copy(Reader reader, Writer writer, long amount) throws IOException
      Parameters:
      reader - Reader
      writer - Writer
      amount - long
      Returns:
      long
      Throws:
      IOException - on failure
      See Also:
    • copy

      public static long copy(Reader reader, Writer writer, long amount, int bufferSize) throws 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:
      IOException - if any, thrown by either of the given stream objects