wt.util
Class FileConsumer

java.lang.Object
  extended bywt.util.Consumer
      extended bywt.util.FileConsumer
All Implemented Interfaces:
Iterator
Direct Known Subclasses:
PropertiesConsumer

public class FileConsumer
extends Consumer

An iteration over a list of files.

Supported API: false
Extendable: false


Nested Class Summary
protected static class FileConsumer.FileConsumerQueue
          An extension of SynchronizedQueue that keeps track of the current file.
protected static class FileConsumer.FileProducer
          Iterates through a list of files, loading each one into the queue.
 
Nested classes inherited from class wt.util.Consumer
Consumer.Producer, Consumer.Queue, Consumer.SynchronizedQueue
 
Field Summary
protected static String DEFAULT_SEPARATOR
           
 
Fields inherited from class wt.util.Consumer
DEFAULT_BUFFER_SIZE, producer, queue
 
Constructor Summary
FileConsumer(String files)
           
FileConsumer(String[] files)
           
FileConsumer(String[] files, int max_buffer_size)
           
FileConsumer(String files, String separator)
           
FileConsumer(String files, String separator, int max_buffer_size)
           
 
Method Summary
protected  Consumer.Producer createProducer(String[] files)
          Hook to let subclasses create a different producer.
protected  Consumer.Queue createQueue(int max_buffer_size)
          Override createQueue to create a FileConsumerQueue
 String getCurrentFile()
           
private static String[] parseFiles(String files, String separator)
           
 
Methods inherited from class wt.util.Consumer
finalize, hasNext, init, init, init, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

protected static final String DEFAULT_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

FileConsumer

public FileConsumer(String[] files,
                    int max_buffer_size)
Parameters:
files - An array of files to be consumed.

FileConsumer

public FileConsumer(String files)
Parameters:
files - A comma-separated list of files.

FileConsumer

public FileConsumer(String files,
                    String separator)
Parameters:
files - A list of files delineated by the separator parameter.
separator - The separator for the files parameter.

FileConsumer

public FileConsumer(String files,
                    String separator,
                    int max_buffer_size)
Parameters:
files - A list of files delineated by the separator parameter.
separator - The separator for the files parameter.

FileConsumer

public FileConsumer(String[] files)
Parameters:
files - An array of files to be consumed.
Method Detail

getCurrentFile

public String getCurrentFile()
Returns:
The file that is currently being consumed or null if all the files have been iterated over.

createQueue

protected final Consumer.Queue createQueue(int max_buffer_size)
Override createQueue to create a FileConsumerQueue

Overrides:
createQueue in class Consumer
Parameters:
max_buffer_size - The maximum size the queue can attain.

createProducer

protected Consumer.Producer createProducer(String[] files)
Hook to let subclasses create a different producer.

Parameters:
files - The list of files to be loaded.

parseFiles

private static final String[] parseFiles(String files,
                                         String separator)