nl.gx.webmanager.handler.util
Class MultiReader

java.lang.Object
  extended by java.io.Reader
      extended by nl.gx.webmanager.handler.util.MultiReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class MultiReader
extends java.io.Reader

This class enables to combine a number of readers into one.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
MultiReader(java.io.Reader[] readers)
          Construct a new Reader combining a list of Readers.
 
Method Summary
 void close()
          Closes all readers that have not been closed yet.
 int read(char[] cbuf, int off, int len)
          Read characters into a portion of an array.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiReader

public MultiReader(java.io.Reader[] readers)
Construct a new Reader combining a list of Readers.

Parameters:
readers - The readers that should be combined.
Method Detail

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Read characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Specified by:
read in class java.io.Reader
Parameters:
cbuf - Destination buffer
off - Offset at which to start storing characters
len - Maximum number of characters to read
Returns:
The number of characters read, or -1 if the end of the stream of all combined readers have been reached.
Throws:
java.io.IOException - If an I/O error occurs

close

public void close()
           throws java.io.IOException
Closes all readers that have not been closed yet.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException - if not all open readers could be closed.


Copyright © 2007-2011 GX Software BV. All Rights Reserved.