Package org.hibernate.engine.jdbc
Class StreamUtils
- java.lang.Object
-
- org.hibernate.engine.jdbc.StreamUtils
-
public class StreamUtils extends Object
Stream copying utilities
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CHUNK_SIZE
Default size to use for reading buffers.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
copy(InputStream inputStream, OutputStream outputStream)
Copy the inputStream to the outputStream.static long
copy(InputStream inputStream, OutputStream outputStream, int bufferSize)
Copy the inputStream to the outputStream using a buffer of the specified sizestatic long
copy(Reader reader, Writer writer)
Copy the reader to the writer.static long
copy(Reader reader, Writer writer, int bufferSize)
Copy the reader to the writer using a buffer of the specified size
-
-
-
Field Detail
-
DEFAULT_CHUNK_SIZE
public static final int DEFAULT_CHUNK_SIZE
Default size to use for reading buffers.- See Also:
- Constant Field Values
-
-
Method Detail
-
copy
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
- The input stream to readoutputStream
- The output stream to write to- Returns:
- The number of bytes read
- Throws:
IOException
- If a problem occurred accessing either stream
-
copy
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
- The input stream to readoutputStream
- The output stream to write tobufferSize
- The size of the buffer to use for reading- Returns:
- The number of bytes read
- Throws:
IOException
- If a problem occurred accessing either stream
-
copy
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
- The reader to read fromwriter
- The writer to write to- Returns:
- The number of bytes read
- Throws:
IOException
- If a problem occurred accessing reader or writer
-
copy
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
- The reader to read fromwriter
- The writer to write tobufferSize
- The size of the buffer to use for reading- Returns:
- The number of bytes read
- Throws:
IOException
- If a problem occurred accessing either stream
-
-