Top Description Fields Constructors Methods
org.hsqldb.lib

public final Class InOutUtil

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, .ObjectInputStream, .ObjectOutputStream, .OutputStream, .Reader, .Serializable, .Writer

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

Field Summary

Modifier and TypeField and Description
public static final long
public static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static long
copy(final InputStream
InputStream
inputStream
,
final OutputStream
OutputStream
outputStream
)

Returns: long

public static long
copy(final InputStream
InputStream
inputStream
,
final OutputStream
OutputStream
outputStream
,
final long
long
amount
)

Returns: long

public static long

Returns:

the number of bytes actually transferred.
copy
(final InputStream
from which to source bytes
inputStream
,
final OutputStream
to which to sink bytes
outputStream
,
final long
max # of bytes to transfer.
amount
,
final int
to use internally
bufferSize
)

the specified amount from the given input stream to the given output stream, using a buffer of the given size.

public static long
copy(final Reader
Reader
reader
,
final Writer
Writer
writer
)

Returns: long

public static long
copy(final Reader
Reader
reader
,
final Writer
Writer
writer
,
final long
long
amount
)

Returns: long

public static long

Returns:

the number of characters actually transferred.
copy
(final Reader
from which to source characters
reader
,
final Writer
to which to sink characters
writer
,
final long
max # of characters to transfer.
amount
,
final int
to use internally
bufferSize
)

the specified amount from the given input stream to the given output stream, using a buffer of the given size.

public static Serializable

Returns:

the Object resulting from deserializing the specified array of bytes
deserialize
(byte[]
the byte array to deserialize to an Object
ba
)

Deserializes the specified byte array to an Object instance.

public static int

Returns:

int
readLine
(InputStream
InputStream
in
,
OutputStream
OutputStream
out
)

Implementation only supports unix line-end format and is suitable for processing HTTP and other network protocol communications.

public static byte[]

Returns:

a static byte array representing the passed Object
serialize
(Serializable
the Object to serialize
s
)

Retrieves the serialized form of the specified Object as an array of bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_COPY_AMOUNTback to summary
public static final long DEFAULT_COPY_AMOUNT
DEFAULT_COPY_BUFFER_SIZEback to summary
public static final int DEFAULT_COPY_BUFFER_SIZE

Constructor Detail

InOutUtilback to summary
private InOutUtil()

Method Detail

copyback to summary
public static long copy(final InputStream inputStream, final OutputStream outputStream) throws IOException
Parameters
inputStream:InputStream

InputStream

outputStream:OutputStream

OutputStream

Returns:long

long

Exceptions
IOException:
on failure
See Also
copy(java.io.InputStream, java.io.OutputStream, long, int)
copyback to summary
public static long copy(final InputStream inputStream, final OutputStream outputStream, final long amount) throws IOException
Parameters
inputStream:InputStream

InputStream

outputStream:OutputStream

OutputStream

amount:long

long

Returns:long

long

Exceptions
IOException:
on failure
See Also
copy(java.io.InputStream, java.io.OutputStream, long, int)
copyback to summary
public static long copy(final InputStream inputStream, final OutputStream outputStream, final long amount, final 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:InputStream

from which to source bytes

outputStream:OutputStream

to which to sink bytes

amount:long

max # of bytes to transfer.

bufferSize:int

to use internally

Returns:long

the number of bytes actually transferred.

Exceptions
IOException:
if any, thrown by either of the given stream objects
copyback to summary
public static long copy(final Reader reader, final Writer writer) throws IOException
Parameters
reader:Reader

Reader

writer:Writer

Writer

Returns:long

long

Exceptions
IOException:
on failure
See Also
copy(java.io.Reader, java.io.Writer, long, int)
copyback to summary
public static long copy(final Reader reader, final Writer writer, final long amount) throws IOException
Parameters
reader:Reader

Reader

writer:Writer

Writer

amount:long

long

Returns:long

long

Exceptions
IOException:
on failure
See Also
copy(java.io.Reader, java.io.Writer, long, int)
copyback to summary
public static long copy(final Reader reader, final Writer writer, final long amount, final 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:Reader

from which to source characters

writer:Writer

to which to sink characters

amount:long

max # of characters to transfer.

bufferSize:int

to use internally

Returns:long

the number of characters actually transferred.

Exceptions
IOException:
if any, thrown by either of the given stream objects
deserializeback to summary
public static Serializable deserialize(byte[] ba) throws IOException, ClassNotFoundException

Deserializes the specified byte array to an Object instance.

Parameters
ba:byte[]

the byte array to deserialize to an Object

Returns:Serializable

the Object resulting from deserializing the specified array of bytes

Exceptions
IOException:
on failure
ClassNotFoundException:
if not found
readLineback to summary
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

InputStream

out:OutputStream

OutputStream

Returns:int

int

Exceptions
IOException:
on failure
serializeback to summary
public static byte[] serialize(Serializable s) throws IOException

Retrieves the serialized form of the specified Object as an array of bytes.

Parameters
s:Serializable

the Object to serialize

Returns:byte[]

a static byte array representing the passed Object

Exceptions
IOException:
on failure