Top Description Fields Constructors Methods
org.hibernate.engine.jdbc

public Class StreamUtils

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

Stream copying utilities
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final int
DEFAULT_CHUNK_SIZE

Default size to use for reading buffers.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static long

Returns:

The number of bytes read
copy
(InputStream
The input stream to read
inputStream
,
OutputStream
The output stream to write to
outputStream
)

Copy the inputStream to the outputStream.

public static long

Returns:

The number of bytes read
copy
(InputStream
The input stream to read
inputStream
,
OutputStream
The output stream to write to
outputStream
,
int
The size of the buffer to use for reading
bufferSize
)

Copy the inputStream to the outputStream using a buffer of the specified size

public static long

Returns:

The number of bytes read
copy
(Reader
The reader to read from
reader
,
Writer
The writer to write to
writer
)

Copy the reader to the writer.

public static long

Returns:

The number of bytes read
copy
(Reader
The reader to read from
reader
,
Writer
The writer to write to
writer
,
int
The size of the buffer to use for reading
bufferSize
)

Copy the reader to the writer using a buffer of the specified size

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_CHUNK_SIZEback to summary
public static final int DEFAULT_CHUNK_SIZE

Default size to use for reading buffers.

Constructor Detail

StreamUtilsback to summary
private StreamUtils()

Method Detail

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

Copy the inputStream to the outputStream. Uses a buffer of the default size (DEFAULT_CHUNK_SIZE).

Parameters
inputStream:InputStream

The input stream to read

outputStream:OutputStream

The output stream to write to

Returns:long

The number of bytes read

Exceptions
IOException:
If a problem occurred accessing either stream
copyback to summary
public static long copy(InputStream inputStream, OutputStream outputStream, int bufferSize) throws IOException

Copy the inputStream to the outputStream using a buffer of the specified size

Parameters
inputStream:InputStream

The input stream to read

outputStream:OutputStream

The output stream to write to

bufferSize:int

The size of the buffer to use for reading

Returns:long

The number of bytes read

Exceptions
IOException:
If a problem occurred accessing either stream
copyback to summary
public static long copy(Reader reader, Writer writer) throws IOException

Copy the reader to the writer. Uses a buffer of the default size (DEFAULT_CHUNK_SIZE).

Parameters
reader:Reader

The reader to read from

writer:Writer

The writer to write to

Returns:long

The number of bytes read

Exceptions
IOException:
If a problem occurred accessing reader or writer
copyback to summary
public static long copy(Reader reader, Writer writer, int bufferSize) throws IOException

Copy the reader to the writer using a buffer of the specified size

Parameters
reader:Reader

The reader to read from

writer:Writer

The writer to write to

bufferSize:int

The size of the buffer to use for reading

Returns:long

The number of bytes read

Exceptions
IOException:
If a problem occurred accessing either stream