com.partnersoft.net.yonder
Class YonderClient

java.lang.Object
  extended by com.partnersoft.net.TcpSocketClient
      extended by com.partnersoft.net.yonder.YonderClient

public class YonderClient
extends TcpSocketClient

Raw client for the Yonder remote file server. You should probably use YonderVfs for general purposes.

Copyright 2004-2007 Partner Software, Inc.

Version:
$Id: YonderClient.java 2328 2010-01-06 15:38:22Z paul $
Author:
Paul Reavis

Constructor Summary
YonderClient(java.lang.String serverName)
           
 
Method Summary
 void close(int fileId)
          Closes the remote file with the given ID.
 void connect(boolean resolveHostName)
          Connect to the YonderServer.
 void disconnect()
          Disconnect from the YonderServer.
 long getLength(int fileId)
           
 YonderFileInfo infoFor(Path path)
          Requests information about a file.
 YonderFileInfo[] listFilesIn(Path dirPath)
          List contents of remote directory.
 void makeDirectory(Path path)
           
 int open(Path path, java.lang.String mode)
          Opens the file at the given path, returning an integer ID that will be used to refer to it henceforth.
 int read(int fileId, long position, byte[] bytes, int offset, int length)
          Reads from the given location in the given open file.
 void remove(Path path)
           
 void setLength(int fileId, long newLength)
           
 void write(int fileId, long position, byte[] bytes, int offset, int length)
          Writes to the given location in the given open file.
 
Methods inherited from class com.partnersoft.net.TcpSocketClient
connect, getInputStream, getName, getOutputStream, getServerName, getServerPortNumber, getSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YonderClient

public YonderClient(java.lang.String serverName)
Method Detail

connect

public void connect(boolean resolveHostName)
             throws java.io.IOException
Connect to the YonderServer. If resolveHostName is true, uses URLLib.resolveHostName(). Otherwise does not.

Overrides:
connect in class TcpSocketClient
Throws:
java.io.IOException

disconnect

public void disconnect()
                throws java.io.IOException
Disconnect from the YonderServer.

Overrides:
disconnect in class TcpSocketClient
Throws:
java.io.IOException

infoFor

public YonderFileInfo infoFor(Path path)
                       throws java.io.IOException
Requests information about a file.

Throws:
java.io.IOException

listFilesIn

public YonderFileInfo[] listFilesIn(Path dirPath)
                             throws java.io.IOException
List contents of remote directory.

Throws:
java.io.IOException

makeDirectory

public void makeDirectory(Path path)
                   throws java.io.IOException
Throws:
java.io.IOException

remove

public void remove(Path path)
            throws java.io.IOException
Throws:
java.io.IOException

open

public int open(Path path,
                java.lang.String mode)
         throws java.io.IOException
Opens the file at the given path, returning an integer ID that will be used to refer to it henceforth. If the remote file does not exist, it will be created. The mode argument is the same as that provided to RandomAccessFile, "r" for read-only, "rw" for read-write.

Throws:
java.io.IOException

close

public void close(int fileId)
           throws java.io.IOException
Closes the remote file with the given ID.

Parameters:
fileId -
Throws:
java.io.IOException

read

public int read(int fileId,
                long position,
                byte[] bytes,
                int offset,
                int length)
         throws java.io.IOException
Reads from the given location in the given open file.

Parameters:
fileId -
position -
Throws:
java.io.IOException

write

public void write(int fileId,
                  long position,
                  byte[] bytes,
                  int offset,
                  int length)
           throws java.io.IOException
Writes to the given location in the given open file.

Throws:
java.io.IOException

setLength

public void setLength(int fileId,
                      long newLength)
               throws java.io.IOException
Throws:
java.io.IOException

getLength

public long getLength(int fileId)
               throws java.io.IOException
Throws:
java.io.IOException