java.lang.Object
org.hsqldb.lib.InOutUtil
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
FieldsModifier and TypeFieldDescriptionstatic final long
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
copy
(InputStream inputStream, OutputStream outputStream) static long
copy
(InputStream inputStream, OutputStream outputStream, long amount) static long
copy
(InputStream inputStream, OutputStream outputStream, long amount, int bufferSize) the specifiedamount
from the given input stream to the given output stream, using a buffer of the given size.static long
static long
static long
the specifiedamount
from the given input stream to the given output stream, using a buffer of the given size.static Serializable
deserialize
(byte[] ba) Deserializes the specified byte array to anObject
instance.static int
readLine
(InputStream in, OutputStream out) Implementation only supports unix line-end format and is suitable for processing HTTP and other network protocol communications.static byte[]
Retrieves the serialized form of the specifiedObject
as an array of bytes.
-
Field Details
-
DEFAULT_COPY_BUFFER_SIZE
public static final int DEFAULT_COPY_BUFFER_SIZE- See Also:
-
DEFAULT_COPY_AMOUNT
public static final long DEFAULT_COPY_AMOUNT- See Also:
-
-
Method Details
-
readLine
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
- InputStreamout
- OutputStream- Returns:
- int
- Throws:
IOException
- on failure
-
serialize
Retrieves the serialized form of the specifiedObject
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
Deserializes the specified byte array to anObject
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 failureClassNotFoundException
- if not found
-
copy
- Parameters:
inputStream
- InputStreamoutputStream
- OutputStream- Returns:
- long
- Throws:
IOException
- on failure- See Also:
-
copy
public static long copy(InputStream inputStream, OutputStream outputStream, long amount) throws IOException - Parameters:
inputStream
- InputStreamoutputStream
- OutputStreamamount
- 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 specifiedamount
from the given input stream to the given output stream, using a buffer of the given size.- Parameters:
inputStream
- from which to source bytesoutputStream
- to which to sink bytesamount
- 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
- Parameters:
reader
- Readerwriter
- Writer- Returns:
- long
- Throws:
IOException
- on failure- See Also:
-
copy
- Parameters:
reader
- Readerwriter
- Writeramount
- 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 specifiedamount
from the given input stream to the given output stream, using a buffer of the given size.- Parameters:
reader
- from which to source characterswriter
- to which to sink charactersamount
- 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
-