org.apache.oozie.util
Class MultiFileReader

java.lang.Object
  extended by java.io.Reader
      extended by org.apache.oozie.util.MultiFileReader
All Implemented Interfaces:
Closeable, Readable

public class MultiFileReader
extends Reader

Implementation of a Reader which can be used to read in multiple files sequentially. That is, when the first file ends it will silently move to the next file and so on. If the file has a ".gz" extension, this Reader will properly handle it; all other types of files will simply be read using a FileReader.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
MultiFileReader(ArrayList<File> files)
          Constructs the MultiFileReader with the given files.
 
Method Summary
 void close()
           
 int read(char[] cbuf, int off, int len)
           
 
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

MultiFileReader

public MultiFileReader(ArrayList<File> files)
                throws IOException
Constructs the MultiFileReader with the given files. The files will be read in the order given in the ArrayList.

Parameters:
files - The files to read
Throws:
IOException - If there was a problem opening the first file
Method Detail

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Reader
Throws:
IOException


Copyright © 2015 Apache Software Foundation. All Rights Reserved.