org.gridlab.gat.io
Class FileInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.gridlab.gat.io.FileInputStream
All Implemented Interfaces:
Closeable, Monitorable

public class FileInputStream
extends InputStream
implements Monitorable

A FileInputStream represents a connection to open file, the file may be either remote or local. See FileInputStream.


Constructor Summary
FileInputStream(org.gridlab.gat.io.FileInputStreamInterface in)
          Do not use this constructor, it is for internal GAT use.
 
Method Summary
 void addMetricListener(MetricListener metricListener, Metric metric)
          This method adds the passed instance of a MetricListener to the list of MetricListeners which are notified of MetricEvents by an instance of this class.
 int available()
          See FileInputStream.available().
 void close()
          See FileInputStream.close().
 boolean equals(Object arg0)
          See Object.equals(java.lang.Object).
 org.gridlab.gat.io.FileInputStreamInterface getFileInputStreamInterface()
          Returns the FileInputStreamInterface object associated with this FileInputStream.
 MetricEvent getMeasurement(Metric metric)
          Returns a MetricEvent that represents the measured Metric.
 MetricDefinition getMetricDefinitionByName(String name)
          Gets the MetricDefinition using its name.
 List<MetricDefinition> getMetricDefinitions()
          This method returns a List of MetricDefinition instances.
 int hashCode()
          See Object.hashCode().
 void mark(int arg0)
          See InputStream.mark(int).
 boolean markSupported()
          See InputStream.markSupported().
 int read()
          See FileInputStream.read().
 int read(byte[] arg0)
          See FileInputStream.read(byte[]).
 int read(byte[] arg0, int arg1, int arg2)
          See FileInputStream.read(byte[], int, int).
 void removeMetricListener(MetricListener metricListener, Metric metric)
          Removes the passed MetricListener from the List of MetricListeners which are notified of MetricEvents corresponding to the passed Metric instance.
 void reset()
          See InputStream.reset().
 long skip(long arg0)
          See FileInputStream.skip(long).
 String toString()
          See Object.toString().
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileInputStream

public FileInputStream(org.gridlab.gat.io.FileInputStreamInterface in)
Do not use this constructor, it is for internal GAT use. Use GAT.create...

Method Detail

getFileInputStreamInterface

public org.gridlab.gat.io.FileInputStreamInterface getFileInputStreamInterface()
Returns the FileInputStreamInterface object associated with this FileInputStream. The FileInputStreamInterface offers the same functionality as the FileInputStream object. The difference between the FileInputStreamInterface object and the FileInputStream object is that the FileInputStreamInterface is an internal GAT object and it will throw GATInvocationExceptions upon failures, whereas the FileInputStream object would have default values.

Returns:
the FileInputStreamInterface object

getMeasurement

public MetricEvent getMeasurement(Metric metric)
                           throws GATInvocationException
Returns a MetricEvent that represents the measured Metric.

Specified by:
getMeasurement in interface Monitorable
Returns:
a MetricEvent that represents the measured Metric.
Throws:
GATInvocationException - the measurement failed

getMetricDefinitionByName

public MetricDefinition getMetricDefinitionByName(String name)
                                           throws GATInvocationException
Gets the MetricDefinition using its name.

Specified by:
getMetricDefinitionByName in interface Monitorable
Parameters:
name - The MetricDefinition name
Returns:
The MetricDefinition with the given name
Throws:
GATInvocationException - An error occurred while getting the list of Metrics or no Metric with this name exists

addMetricListener

public void addMetricListener(MetricListener metricListener,
                              Metric metric)
                       throws GATInvocationException
This method adds the passed instance of a MetricListener to the list of MetricListeners which are notified of MetricEvents by an instance of this class. The passed MetricListener is only notified of MetricEvents which correspond to Metric instance passed to this method.

Specified by:
addMetricListener in interface Monitorable
Parameters:
metricListener - The MetricListener to notify of MetricEvents
metric - The Metric corresponding to the MetricEvents for which the passed MetricListener will be notified
Throws:
GATInvocationException - The MetricListener cannot be added

available

public int available()
              throws IOException
See FileInputStream.available().

Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
See FileInputStream.close().

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

equals

public boolean equals(Object arg0)
See Object.equals(java.lang.Object).

Overrides:
equals in class Object

getMetricDefinitions

public List<MetricDefinition> getMetricDefinitions()
                                            throws GATInvocationException
This method returns a List of MetricDefinition instances. Each instance in this List is a MetricDefinition which can be monitored on this instance.

Specified by:
getMetricDefinitions in interface Monitorable
Returns:
An List of MetricDefinition instances. Each instance in this List is a Metric which can be monitored on this instance
Throws:
GATInvocationException - An error occurred while getting the list of metrics

hashCode

public int hashCode()
See Object.hashCode().

Overrides:
hashCode in class Object

mark

public void mark(int arg0)
See InputStream.mark(int).

Overrides:
mark in class InputStream

markSupported

public boolean markSupported()
See InputStream.markSupported().

Overrides:
markSupported in class InputStream

read

public int read()
         throws IOException
See FileInputStream.read().

Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] arg0)
         throws IOException
See FileInputStream.read(byte[]).

Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] arg0,
                int arg1,
                int arg2)
         throws IOException
See FileInputStream.read(byte[], int, int).

Overrides:
read in class InputStream
Throws:
IOException

removeMetricListener

public void removeMetricListener(MetricListener metricListener,
                                 Metric metric)
                          throws GATInvocationException
Removes the passed MetricListener from the List of MetricListeners which are notified of MetricEvents corresponding to the passed Metric instance.

Specified by:
removeMetricListener in interface Monitorable
Parameters:
metricListener - The MetricListener to notify of MetricEvents
metric - The Metric corresponding to the MetricEvents for which the passed MetricListener has been notified
Throws:
GATInvocationException - The MetricListener cannot be removed

reset

public void reset()
           throws IOException
See InputStream.reset().

Overrides:
reset in class InputStream
Throws:
IOException

skip

public long skip(long arg0)
          throws IOException
See FileInputStream.skip(long).

Overrides:
skip in class InputStream
Throws:
IOException

toString

public String toString()
See Object.toString().

Overrides:
toString in class Object