Remote Systems
v6.4.1

com.ibm.etools.systems.dstore.core.model
Class ByteStreamHandler

java.lang.Object
  extended bycom.ibm.etools.systems.dstore.core.model.ByteStreamHandler
All Implemented Interfaces:
IByteStreamHandler
Direct Known Subclasses:
UniversalByteStreamHandler

public class ByteStreamHandler
extends Object
implements IByteStreamHandler

The ByteStreamHandler class is used to abstract file read and write operations across the network. By default this is used for sending and receiving files on the client and the server. The class can be extended if the default byte stream implementations are not sufficient for a particular platform or use.

If ByteStreamHandler is extended, you need to tell the DataStore to use the extended implementation. To do that, call DataStore.setByteStreamHandler(ByteStreamHandler).


Field Summary
protected  DataStore _dataStore
           
protected  DataElement _log
           
static String Copyright
           
protected static String FILEMSG_REMOTE_SAVE_FAILED
           
 
Constructor Summary
ByteStreamHandler(DataStore dataStore, DataElement log)
          Contructor
 
Method Summary
protected  DataElement findStatusFor(String remotePath)
           
 String getId()
          Returns the unique ID for this bytestream handler
protected  void internalSendAppendBytes(String path, byte[] bytes, int size, boolean binary)
          Called by sendBytes to either append the bytes to a local file or transmit them and append them to a remote file.
protected  void internalSendBytes(String path, byte[] bytes, int size, boolean binary)
          Called by sendBytes to either save the bytes to a local file or transmit them to a remote file.
 void receiveAppendedBytes(String remotePath, byte[] buffer, int size, boolean binary)
          Append a bytes to a file at a specified location.
 void receiveBytes(String remotePath, byte[] buffer, int size, boolean binary)
          Save a file in the specified location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

_dataStore

protected DataStore _dataStore

_log

protected DataElement _log

FILEMSG_REMOTE_SAVE_FAILED

protected static final String FILEMSG_REMOTE_SAVE_FAILED
See Also:
Constant Field Values
Constructor Detail

ByteStreamHandler

public ByteStreamHandler(DataStore dataStore,
                         DataElement log)
Contructor

Parameters:
dataStore - the DataStore instance
Method Detail

getId

public String getId()
Description copied from interface: IByteStreamHandler
Returns the unique ID for this bytestream handler

Specified by:
getId in interface IByteStreamHandler
Returns:
the unique id

receiveBytes

public void receiveBytes(String remotePath,
                         byte[] buffer,
                         int size,
                         boolean binary)
Save a file in the specified location. This method is called by the DataStore when the communication layer receives a file transfer

Specified by:
receiveBytes in interface IByteStreamHandler
Parameters:
remotePath - the path where to save the file
buffer - the bytes to insert in the file
size - the number of bytes to insert
binary - indicates whether to save the bytes as binary or text

receiveAppendedBytes

public void receiveAppendedBytes(String remotePath,
                                 byte[] buffer,
                                 int size,
                                 boolean binary)
Append a bytes to a file at a specified location. This method is called by the DataStore when the communication layer receives a file transfer append.

Specified by:
receiveAppendedBytes in interface IByteStreamHandler
Parameters:
remotePath - the path where to save the file
buffer - the bytes to append in the file
size - the number of bytes to append in the file
binary - indicates whether to save the bytes as binary or text

internalSendBytes

protected void internalSendBytes(String path,
                                 byte[] bytes,
                                 int size,
                                 boolean binary)
Called by sendBytes to either save the bytes to a local file or transmit them to a remote file.

Parameters:
path - the path of the file
bytes - the bytes of the file
size - the size of the file
binary - indicates whether the bytes are to be sent as binary or text

internalSendAppendBytes

protected void internalSendAppendBytes(String path,
                                       byte[] bytes,
                                       int size,
                                       boolean binary)
Called by sendBytes to either append the bytes to a local file or transmit them and append them to a remote file.

Parameters:
path - the path of the file
bytes - the bytes of the file
size - the size of the file
binary - indicates whether the bytes are to be sent as binary or text

findStatusFor

protected DataElement findStatusFor(String remotePath)

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.