JProjects.eab.data
Class DAIOStream

java.lang.Object
  |
  +--JProjects.eab.data.DAIOStream

public class DAIOStream
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class is used for handling Large Object (LOB) input and output by using streams.

See Also:
Serialized Form

Constructor Summary
DAIOStream()
          This constructor creates a DAIOStream object with input and output streams set to null.
DAIOStream(java.io.InputStream in, java.io.OutputStream out)
          This constructor creates a DAIOStream object with the specified attributes.
DAIOStream(java.lang.String fileName)
          This constructor creates a DAIOStream object that writes to the specified file.
DAIOStream(java.lang.String fileName, int readL, int blockS)
          This constructor creates a DAIOStream object that writes to the specified file.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 java.lang.Object clone()
          Use this method to create an Object with the same attributes as the current DAIOStream object.
 int getBlockSize()
          Use this method to get the size, in bytes, of the block of information that will be read from the stream at a time.
 int getBytesWritten()
          Use this method to get the number of bytes read from the current DAIOStream object into the output stream.
 java.io.InputStream getDatabaseInputStream()
          Use this method to get the input stream that was saved when getFromInputStream was called (if no output stream was specified and save was set to true).
 java.lang.String getFileName()
          Use this method to return the name of the output file.It returns an empty string if the current file setting is null.
 int getFromLob(java.io.InputStream in, boolean save)
          When a manager method fetches a DAIOStream object from a row, it puts the associated stream into the internal sequence.
 java.io.InputStream getInputStream()
          Use this method to return the input stream that is associated with the current LOB.
 java.io.InputStream getInputStreamOrFile()
          Manager uses this method to get the InputStream object associated with the current DAIOStream object.
 java.io.OutputStream getOutputStream()
          Use this method to get OutputStream object associated with this DAIOStream object.
 java.io.OutputStream getOutputStreamOrFile()
          Manager uses this method to get OutputStream object associated with this DAIOStream object.
 int getReadLength()
          Use this method to get the length if data, in bytes, that will be read from the current DAIOStream object into the output stream.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void setBlockSize(int blSz)
          Use this method to set the size, in bytes, of the block of information to read from the stream at a time.
 void setFileName(java.lang.String fileName)
          Use this method to set the name of the current output file.
 void setInputStream(java.io.InputStream in)
          Use this method to set the input stream that is associated with the current LOB.
 void setOutputStream(java.io.OutputStream out)
          Use this method to set OutputStream object associated with this DAIOStream object.
 void setReadLength(int readLen)
          Use this method to specify the length of data, in bytes, that you want to read from the current DAIOStream object into the output stream.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAIOStream

public DAIOStream(java.lang.String fileName,
                  int readL,
                  int blockS)
This constructor creates a DAIOStream object that writes to the specified file. Length of the data to read (in bytes) and read block size also specified.
Parameters:
fileName - name of the file.
readL - an integer indicating the length (in bytes) to be read from the object into the output stream. If you pass in 0 (zero), then the entire LOB is extracted to the output stream.
blockS - read block size in bytes.

DAIOStream

public DAIOStream(java.io.InputStream in,
                  java.io.OutputStream out)
This constructor creates a DAIOStream object with the specified attributes.
Parameters:
in - input data stream.
out - output data stream.

DAIOStream

public DAIOStream(java.lang.String fileName)
This constructor creates a DAIOStream object that writes to the specified file.
Parameters:
fileName - name of the file.

DAIOStream

public DAIOStream()
This constructor creates a DAIOStream object with input and output streams set to null.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)

clone

public java.lang.Object clone()
Use this method to create an Object with the same attributes as the current DAIOStream object.
Overrides:
clone in class java.lang.Object

getBlockSize

public int getBlockSize()
Use this method to get the size, in bytes, of the block of information that will be read from the stream at a time.
Returns:
an integer indicating the current read block size.

setBlockSize

public void setBlockSize(int blSz)
Use this method to set the size, in bytes, of the block of information to read from the stream at a time.
Parameters:
blSz - the size, in bytes, of the block of information to read from the stream at a time.

getBytesWritten

public int getBytesWritten()
Use this method to get the number of bytes read from the current DAIOStream object into the output stream.
Returns:
an integer indicating the number of bytes directed to the output stream.

getDatabaseInputStream

public java.io.InputStream getDatabaseInputStream()
Use this method to get the input stream that was saved when getFromInputStream was called (if no output stream was specified and save was set to true).

getFromLob

public int getFromLob(java.io.InputStream in,
                      boolean save)
When a manager method fetches a DAIOStream object from a row, it puts the associated stream into the internal sequence. Use this method to direct that stream into the current output stream. If the current output is null and the save parameter has the value true, the method saves a reference to the input stream so that you can extract it later.
Parameters:
in - the InputStream for the LOB in the current fetched row.
save - Pass in true if you want to save the input stream reference if there is no output stream specified. You can direct the stream later. If you do not want to save the input stream reference, pass in false.
Returns:
an integer indicating the number of bytes read into the LOB. This will return 0 (zero) if in is null, or if the stream is saved to a reference rather than directed to output.

getInputStream

public java.io.InputStream getInputStream()
Use this method to return the input stream that is associated with the current LOB.
Returns:
the InputStream object associated with the current DAIOStream object.

setInputStream

public void setInputStream(java.io.InputStream in)
Use this method to set the input stream that is associated with the current LOB.
Parameters:
in - the InputStream object to associate with the current DAIOStream object.

getInputStreamOrFile

public java.io.InputStream getInputStreamOrFile()
Manager uses this method to get the InputStream object associated with the current DAIOStream object. If that object is null and input file name is not null, then FileInputStream is created.
Returns:
the InputStream object associated with the current DAIOStream object.

getFileName

public java.lang.String getFileName()
Use this method to return the name of the output file.It returns an empty string if the current file setting is null.
Returns:
a string indicating the name of the current output file.

setFileName

public void setFileName(java.lang.String fileName)
Use this method to set the name of the current output file.
Parameters:
fileName - a string indicating the name of the output file.

getOutputStream

public java.io.OutputStream getOutputStream()
Use this method to get OutputStream object associated with this DAIOStream object.
Returns:
an OutputStream object assosiated with this DAIOStream object.

setOutputStream

public void setOutputStream(java.io.OutputStream out)
Use this method to set OutputStream object associated with this DAIOStream object.
Parameters:
out - an OutputStream object that gets associated with this DAIOStream object.

getReadLength

public int getReadLength()
Use this method to get the length if data, in bytes, that will be read from the current DAIOStream object into the output stream.
Returns:
an integer indicating the current setting of the read length.

setReadLength

public void setReadLength(int readLen)
Use this method to specify the length of data, in bytes, that you want to read from the current DAIOStream object into the output stream. If you set the read length to 0 (zero), all the data in the DAIOStream object will be directed to the output stream.
Parameters:
readLen - an integer indicating the desired read length, in bytes.

getOutputStreamOrFile

public java.io.OutputStream getOutputStreamOrFile()
Manager uses this method to get OutputStream object associated with this DAIOStream object. If that object is null and output file name is not null, then FileOutputStream is created.
Returns:
an OutputStream object associated with this DAIOStream object.