org.ow2.jasmine.monitoring.mbeancmd
Class Iner

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.Iner
All Implemented Interfaces:
java.lang.Runnable

public class Iner
extends java.lang.Object
implements java.lang.Runnable

A pipe consists of a pair of channels: a writable channel (called "sink", where information is written to) and a readable channel (called "source", where information is obtained from). The general idea is that once some bytes are available on the source: 1. The pipe reads those bytes. 2. If required, does some action with some or all of these bytes (for example, write them to a file). 3. If a sink is present, writes the exact same bytes in the exact same order on the sink. An Iner instance can retrieve information from (=use as source) an InputStream or a File.


Field Summary
private  java.io.PipedOutputStream sink
          Sink.
private  java.io.LineNumberReader source
          Lines input line per line.
private  java.io.PrintWriter wsink
          Writer that writes on the sink.
 
Constructor Summary
Iner(java.io.File file)
          Creates an Iner using a File as source.
Iner(java.io.InputStream in)
          Creates an Iner using an InputStream as source.
 
Method Summary
 java.io.PipedOutputStream getSink()
           
 void run()
          Starts the activity on the Iner (as described in the class header).
 void setSink(java.io.PipedOutputStream sink)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private java.io.LineNumberReader source
Lines input line per line.


sink

private java.io.PipedOutputStream sink
Sink. A dummy sink will be created if the user doesn't specify any.


wsink

private java.io.PrintWriter wsink
Writer that writes on the sink.

Constructor Detail

Iner

public Iner(java.io.InputStream in)
Creates an Iner using an InputStream as source. A dummy sink (that can be used an input to any pipe, @see Iner.getSink) will be created by default.

Parameters:
in - InputStream to use as source.
See Also:
setSink(PipedOutputStream)

Iner

public Iner(java.io.File file)
     throws java.io.FileNotFoundException
Creates an Iner using a File as source. A dummy sink (that can be used an input to any pipe, @see Iner.getSink) will be created by default.

Parameters:
file - File to use as source.
Throws:
java.io.FileNotFoundException - If file not found.
See Also:
setSink(PipedOutputStream)
Method Detail

setSink

public void setSink(java.io.PipedOutputStream sink)
Parameters:
sink - Sink to set. A dummy sink will be created if null.

getSink

public java.io.PipedOutputStream getSink()
Returns:
The sink currently used.

run

public void run()
Starts the activity on the Iner (as described in the class header).

Specified by:
run in interface java.lang.Runnable