diff options
Diffstat (limited to 'java/JACE/Connection/Blob.java')
-rw-r--r-- | java/JACE/Connection/Blob.java | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/java/JACE/Connection/Blob.java b/java/JACE/Connection/Blob.java deleted file mode 100644 index d3102c81aa2..00000000000 --- a/java/JACE/Connection/Blob.java +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************* - * - * = PACKAGE - * JACE.Connection - * - * = FILENAME - * Blob.java - * - *@author Prashant Jain - * - *************************************************/ -package JACE.Connection; - -import java.io.*; -import java.net.*; -import JACE.SOCK_SAP.*; -import JACE.ASX.*; -import JACE.OS.*; - -/** - * Provides a way of reading from or writing to a remote file - * using MessageBlocks. - */ -public class Blob -{ - /** - * Initialize the Blob. - * - *@param filename File to read or write - *@param hostname Host to contact for the file - *@param port Port on which to connect - */ - public int open (String filename, String hostname , int port) - { - this.filename_ = filename; - this.hostname_ = hostname; - this.port_ = port; - return 0; - } - - /** - * Read a certain amount from the file. - */ - public MessageBlock read (int length, int offset) - { - // Check if we have a valid length and a valid offset - if (length < 0 || offset < 0) - { - ACE.ERROR ("Blob::read(): Negative length or offset"); - return null; - } - - // Create a Blob Reader - BlobReader blobReader = new BlobReader (length, - offset, - this.filename_, - this.hostname_, this.port_); - - // Receive data - MessageBlock mb = blobReader.receiveData (); - if (blobReader.bytesRead () != length) - return null; - else - return mb; - } - - /** - * Write a certain amount to the file. - */ - public int write (MessageBlock mb, int length, int offset) - { - // Check if we have a valid length and a valid offset - if (length < 0 || offset < 0) - ACE.ERROR ("Blob::write(): Negative length or offset"); - - // Create a Blob Writer - BlobWriter blobWriter = new BlobWriter (mb, length, offset, this.filename_); - - try - { - // Connect to the server - this.connector_.open (this.hostname_, this.port_); - this.connector_.connect (blobWriter); - } - catch (UnknownHostException e) - { - ACE.ERROR (e); - } - catch (InstantiationException e) - { - ACE.ERROR (e); - } - catch (IllegalAccessException e) - { - ACE.ERROR (e); - } - catch (IOException e) - { - ACE.ERROR (e); - } - - return blobWriter.bytesWritten (); - } - - public int close () - { - return 0; - } - - String filename_; - String hostname_; - int port_; - Connector connector_ = new Connector (); -} |