JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.io
Class ARGVEnumeration

java.lang.Object
  extended by net.sf.japi.io.ARGVEnumeration
All Implemented Interfaces:
Enumeration<InputStream>

public class ARGVEnumeration
extends Object
implements Enumeration<InputStream>

Implementation of Enumeration for ARGV. Used by ARGVInputStream and ARGVReader. This class looks as if it could instead be an Iterator, but it is intended for use with SequenceInputStream.

Author:
Christian Hujer
See Also:
ARGVInputStream, ARGVReader

Constructor Summary
ARGVEnumeration(String... args)
          Create an ARGVEnumeration.
ARGVEnumeration(ThrowableHandler<? super FileNotFoundException> handler, String... args)
          Create an ARGVEnumeration.
 
Method Summary
 void addThrowableHandler(ThrowableHandler<? super FileNotFoundException> handler)
          Register an exception handler.
 String getCurrentFilename()
          Get the name of the current file.
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
protected  void log(FileNotFoundException e)
          Log an exception.
 InputStream nextElement()
          Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
 void removeThrowableHandler(ThrowableHandler<? super FileNotFoundException> handler)
          Unregister an exception handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ARGVEnumeration

public ARGVEnumeration(String... args)
Create an ARGVEnumeration.

Parameters:
args - Command line arguments or some other String array containing 0 or more file names.

ARGVEnumeration

public ARGVEnumeration(ThrowableHandler<? super FileNotFoundException> handler,
                       String... args)
Create an ARGVEnumeration.

Parameters:
handler - ThrowableHandler to add
args - Command line arguments or some other String array containing 0 or more file names.
Method Detail

log

protected void log(FileNotFoundException e)
Log an exception. Currently does nothing but tell the registered exception handlers to handle the exception.

Parameters:
e - Exception to log

addThrowableHandler

public void addThrowableHandler(ThrowableHandler<? super FileNotFoundException> handler)
Register an exception handler.

Parameters:
handler - New ThrowableHandler

getCurrentFilename

public String getCurrentFilename()
Get the name of the current file.


hasMoreElements

public boolean hasMoreElements()
Description copied from interface: java.util.Enumeration
Tests if this enumeration contains more elements.

Specified by:
hasMoreElements in interface Enumeration<InputStream>
Returns:
true if and only if this enumeration object contains at least one more element to provide; false otherwise.
See Also:
Enumeration

nextElement

public InputStream nextElement()
Description copied from interface: java.util.Enumeration
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Specified by:
nextElement in interface Enumeration<InputStream>
Returns:
the next element of this enumeration.
See Also:
Elements returned are InputStreams.

removeThrowableHandler

public void removeThrowableHandler(ThrowableHandler<? super FileNotFoundException> handler)
Unregister an exception handler.

Parameters:
handler - ThrowableHandler to be removed

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright