OOoRunner test harness

helper
Class StreamSimulator

helper.StreamSimulator

public class StreamSimulator

It simulates an input and output stream and implements the interfaces XInputStream, XOutputStream. So it can be used for testing loading/saving of documents using streams instead of URLs.


Field Summary
 boolean m_bInWasUsed
           
 boolean m_bOutWasUsed
           
 
Constructor Summary
StreamSimulator(String sFileName, boolean bInput, TestParameters param)
          construct a new instance of this class It set the name of the correspojnding file on disk, which should be source or target for the following operations on this object.
 
Method Summary
 int available()
           
 void closeInput()
           
 void closeOutput()
           
 void flush()
           
 long getLength()
           
 long getPosition()
           
 int readBytes(byte[][] lData, int nBytesToRead)
          following methods simulates the XInputStream.
 int readSomeBytes(byte[][] lData, int nMaxBytesToRead)
           
 void seek(long nLocation)
          following methods simulates the XSeekable.
 void skipBytes(int nBytesToSkip)
           
 void writeBytes(byte[] lData)
          following methods simulates the XOutputStream.
 

Field Detail

m_bInWasUsed

public boolean m_bInWasUsed

m_bOutWasUsed

public boolean m_bOutWasUsed
Constructor Detail

StreamSimulator

public StreamSimulator(String sFileName,
                       boolean bInput,
                       TestParameters param)
                throws NotConnectedException
construct a new instance of this class It set the name of the correspojnding file on disk, which should be source or target for the following operations on this object. And it regulate if it should function as input or output stream.
Parameters:
sFileName - name of the file on disk Will be used as source (if param bInput==true) or as target (if param bInput==false).
bInput - it specify, which interface should work at this object. => we simulate an input stream => we simulate an output stream
Method Detail

readBytes

public int readBytes(byte[][] lData,
                     int nBytesToRead)
              throws NotConnectedException,
                     BufferSizeExceededException,
                     IOException
following methods simulates the XInputStream. The notice all actions inside the internal protocol and try to map all neccessary functions to the internal open in-stream.

readSomeBytes

public int readSomeBytes(byte[][] lData,
                         int nMaxBytesToRead)
                  throws NotConnectedException,
                         BufferSizeExceededException,
                         IOException

skipBytes

public void skipBytes(int nBytesToSkip)
               throws NotConnectedException,
                      BufferSizeExceededException,
                      IOException

available

public int available()
              throws NotConnectedException,
                     IOException

closeInput

public void closeInput()
                throws NotConnectedException,
                       IOException

writeBytes

public void writeBytes(byte[] lData)
                throws NotConnectedException,
                       BufferSizeExceededException,
                       IOException
following methods simulates the XOutputStream. The notice all actions inside the internal protocol and try to map all neccessary functions to the internal open out-stream.

flush

public void flush()
           throws NotConnectedException,
                  BufferSizeExceededException,
                  IOException

closeOutput

public void closeOutput()
                 throws NotConnectedException,
                        BufferSizeExceededException,
                        IOException

seek

public void seek(long nLocation)
          throws IllegalArgumentException,
                 IOException
following methods simulates the XSeekable. The notice all actions inside the internal protocol and try to map all neccessary functions to the internal open stream.

getPosition

public long getPosition()
                 throws IOException

getLength

public long getLength()
               throws IOException

OOoRunner test harness