Remote System Explorer DataStore
Release 3.4

org.eclipse.dstore.core.model
Class ByteStreamHandler

java.lang.Object
  extended by org.eclipse.dstore.core.model.ByteStreamHandler
All Implemented Interfaces:
IByteStreamHandler

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
           
protected static String FILEMSG_REMOTE_SAVE_FAILED
           
 
Constructor Summary
ByteStreamHandler(DataStore dataStore, DataElement log)
          Constructor
 
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

_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)
Constructor

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 System Explorer DataStore
Release 3.4

Copyright (c) IBM Corporation and others 2000, 2012. All Rights Reserved.