FileDocCategorySizeDatePackage
IOTools.javaAPI DocGlassfish v2 API3943Fri May 04 22:32:30 BST 2007org.apache.catalina.util

IOTools

public class IOTools extends Object
Contains commonly needed I/O-related methods
author
Dan Sandberg

Fields Summary
protected static final int
DEFAULT_BUFFER_SIZE
Constructors Summary
private IOTools()

 //4k

    //Ensure non-instantiability
      
    
Methods Summary
public static voidflow(java.io.Reader reader, java.io.Writer writer, char[] buf)
Read input from reader and write it to writer until there is no more input from reader.

param
reader the reader to read from.
param
writer the writer to write to.
param
buf the char array to use as a bufferx

        int numRead;
        while ( (numRead = reader.read(buf) ) >= 0) {
            writer.write(buf, 0, numRead);
        }
    
public static voidflow(java.io.Reader reader, java.io.Writer writer)

see
flow( Reader, Writer, char[] )

        char[] buf = new char[DEFAULT_BUFFER_SIZE];
        flow( reader, writer, buf );
    
public static voidflow(java.io.InputStream is, java.io.OutputStream os, byte[] buf)
Read input from input stream and write it to output stream until there is no more input from input stream.

param
input stream the input stream to read from.
param
output stream the output stream to write to.
param
buf the byte array to use as a buffer

        int numRead;
        while ( (numRead = is.read(buf) ) >= 0) {
            os.write(buf, 0, numRead);
        }
    
public static voidflow(java.io.InputStream is, java.io.OutputStream os)

see
flow( Reader, Writer, byte[] )

        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
        flow( is, os, buf );