org.gridlab.gat.io
Class FileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.gridlab.gat.io.FileOutputStream
All Implemented Interfaces:
Closeable, Flushable, Monitorable

public class FileOutputStream
extends OutputStream
implements Monitorable

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


Constructor Summary
FileOutputStream(org.gridlab.gat.io.FileOutputStreamInterface out)
          Do not use this constructur, 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.
 void close()
          See OutputStream.close().
 boolean equals(Object arg0)
          See Object.equals(java.lang.Object).
 void flush()
          See OutputStream.flush().
 org.gridlab.gat.io.FileOutputStreamInterface getFileOutputStreamInterface()
          Returns the FileOutputStreamInterface object associated with this FileOutputStream.
 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 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.
 String toString()
          See Object.toString().
 void write(byte[] arg0)
          See OutputStream.write(byte[]).
 void write(byte[] arg0, int arg1, int arg2)
          See OutputStream.write(byte[], int, int).
 void write(int arg0)
          See OutputStream.write(int).
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileOutputStream

public FileOutputStream(org.gridlab.gat.io.FileOutputStreamInterface out)
Do not use this constructur, it is for internal GAT use.

Method Detail

getFileOutputStreamInterface

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

Returns:
the FileOutputStreamInterface object

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

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

close

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

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

equals

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

Overrides:
equals in class Object

flush

public void flush()
           throws IOException
See OutputStream.flush().

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

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

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

toString

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

Overrides:
toString in class Object

write

public void write(byte[] arg0)
           throws IOException
See OutputStream.write(byte[]).

Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] arg0,
                  int arg1,
                  int arg2)
           throws IOException
See OutputStream.write(byte[], int, int).

Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int arg0)
           throws IOException
See OutputStream.write(int).

Specified by:
write in class OutputStream
Throws:
IOException