ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.oroinc.io.Util

java.lang.Object
   |
   +----com.oroinc.io.Util

public final class Util
extends Object
The Util class cannot be instantiated and stores short static convenience methods that are often quite useful.

Copyright © 1997 Original Reusable Objects, Inc. All rights reserved.


Variable Index

 o DEFAULT_COPY_BUFFER_SIZE
The default buffer size used by copyStream and copyReader .

Method Index

 o copyReader(Reader, Writer)
Same as copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE);
 o copyReader(Reader, Writer, int)
Copies the contents of a Reader to a Writer using a copy buffer of a given size.
 o copyStream(InputStream, OutputStream)
Same as copyStream(source, dest, DEFAULT_COPY_BUFFER_SIZE);
 o copyStream(InputStream, OutputStream, int)
Copies the contents of an InputStream to an OutputStream using a copy buffer of a given size.

Variables

 o DEFAULT_COPY_BUFFER_SIZE
 public static final int DEFAULT_COPY_BUFFER_SIZE
The default buffer size used by copyStream and copyReader . It's value is 1024.

Methods

 o copyStream
 public static final int copyStream(InputStream source,
                                    OutputStream dest,
                                    int bufferSize) throws IOException
Copies the contents of an InputStream to an OutputStream using a copy buffer of a given size. The contents of the InputStream are read until the end of the stream is reached, but neither the source nor the destination are closed. You must do this yourself outside of the method call. The number of bytes read/written is returned.

Parameters:
source - The source InputStream.
dest - The destination OutputStream.
Returns:
The number of bytes read/written in the copy operation.
Throws: IOException
If an error occurs while reading from the source or writing to the destination.
 o copyStream
 public static final int copyStream(InputStream source,
                                    OutputStream dest) throws IOException
Same as copyStream(source, dest, DEFAULT_COPY_BUFFER_SIZE);

 o copyReader
 public static final int copyReader(Reader source,
                                    Writer dest,
                                    int bufferSize) throws IOException
Copies the contents of a Reader to a Writer using a copy buffer of a given size. The contents of the Reader are read until its end is reached, but neither the source nor the destination are closed. You must do this yourself outside of the method call. The number of characters read/written is returned.

Parameters:
source - The source Reader.
dest - The destination writer.
Returns:
The number of characters read/written in the copy operation.
Throws: IOException
If an error occurs while reading from the source or writing to the destination.
 o copyReader
 public static final int copyReader(Reader source,
                                    Writer dest) throws IOException
Same as copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE);


ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index