org.apache.taglibs.io
Class PipeHelper

java.lang.Object
  extended by org.apache.taglibs.io.PipeHelper

public class PipeHelper
extends java.lang.Object

A collection of helper methods for pipelining data between tags.

Version:
$Revision: 216774 $
Author:
James Strachan

Field Summary
protected static int BUFFER_SIZE
          Size of the buffer used when piping a stream
protected static boolean CLOSE_READER
          Temporarily disable the closing of Readers
 
Constructor Summary
PipeHelper()
           
 
Method Summary
static java.io.Reader getReader(java.lang.Object input)
          Uses the standard pipelining guidelines to produce a Reader instance for the given object.
static java.io.Writer getWriter(java.lang.Object output)
          Uses the standard pipelining guidelines to produce a Writer instance for the given object.
static void pipe(java.io.InputStream input, java.io.OutputStream output)
          Pipes all the input to the given output.
static void pipe(java.io.InputStream input, java.io.OutputStream output, byte[] buffer)
          Pipes all the input to the given output.
static void pipe(java.io.Reader reader, java.io.Writer writer)
          Pipes all the input from the given reader to the given writer.
static void pipe(java.io.Reader reader, java.io.Writer writer, char[] buffer)
          Pipes all the input from the given reader to the given writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

protected static final int BUFFER_SIZE
Size of the buffer used when piping a stream

See Also:
Constant Field Values

CLOSE_READER

protected static final boolean CLOSE_READER
Temporarily disable the closing of Readers

See Also:
Constant Field Values
Constructor Detail

PipeHelper

public PipeHelper()
Method Detail

getReader

public static java.io.Reader getReader(java.lang.Object input)
Uses the standard pipelining guidelines to produce a Reader instance for the given object. The object can be either a Reader, an InputStream or a String.

Returns:
a Reader for the given input or null if the instance could not be converted into a Reader.

getWriter

public static java.io.Writer getWriter(java.lang.Object output)
Uses the standard pipelining guidelines to produce a Writer instance for the given object. The object can be either a Writer or an InputStream.

Returns:
a Writer for the given input or null if the instance could not be converted into a Writer.

pipe

public static void pipe(java.io.Reader reader,
                        java.io.Writer writer)
                 throws java.io.IOException
Pipes all the input from the given reader to the given writer. The reader will be closed whether an error occurs or not. Though the writer is left open.

Throws:
java.io.IOException

pipe

public static void pipe(java.io.Reader reader,
                        java.io.Writer writer,
                        char[] buffer)
                 throws java.io.IOException
Pipes all the input from the given reader to the given writer. The reader will be closed whether an error occurs or not. Though the writer is left open.

Throws:
java.io.IOException

pipe

public static void pipe(java.io.InputStream input,
                        java.io.OutputStream output)
                 throws java.io.IOException
Pipes all the input to the given output. The input stream will be closed whether an error occurs or not. Though the output stream is left open is left open.

Throws:
java.io.IOException

pipe

public static void pipe(java.io.InputStream input,
                        java.io.OutputStream output,
                        byte[] buffer)
                 throws java.io.IOException
Pipes all the input to the given output. The input stream will be closed whether an error occurs or not. Though the output stream is left open is left open.

Throws:
java.io.IOException


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.