Service Activator Toolkit
Version 1.0.0

org.eclipse.soda.sat.core.framework.interfaces
Interface ILineReader


public interface ILineReader

The ILineReader interface defines the API for line-oriented reading of an InputStream. An instance of ILineReader can be created using the FactoryUtility singleton.

 InputStream stream = ...
 FactoryUtility utility = FactoryUtility.getInstance();
 try {
   ILineReader reader = null;
   try {
     reader = utility.createLineReader(stream);
     ...
   } finally {
     if (reader != null) {
       reader.close();
     }
   }
 } catch (IOException exception) {
   ...
 } 
 
While a single line may be read using the readLine() method, reading multiple lines is typically done by calling the lines() method that returns an Enumeration.
 Enumeration lines = reader.lines();
 while (lines.hasMoreElements() == true) {
   String line = (String) lines.nextElement();
   ...
 }
 
The nested IAdvisor interface defines the advice that can be given an ILineReader as each line is read.

See Also:
ILineReader.IAdvisor, FactoryUtility

Nested Class Summary
static interface ILineReader.IAdvisor
          The IAdvisor interface defines the advice that can be given to an ILineReader as each line is read.
 
Method Summary
 void close()
          Close the receiver.
 Enumeration lines()
          Answers an Enumeration for reading lines.
 String readLine()
          Reads and answers a single line.
 

Method Detail

close

public void close()
           throws IOException
Close the receiver.

Throws:
java.io.IOException
IOException

lines

public Enumeration lines()
Answers an Enumeration for reading lines.

Returns:
An Enumeration used for reading the lines from the InputStream.

readLine

public String readLine()
                throws IOException
Reads and answers a single line.

Returns:
A String containing single line from the source InputStream.
Throws:
java.io.IOException
IOException

Service Activator Toolkit
Version 1.0.0