public class java.lang.FileClient { // Constructors public FileClient(HostClient host, String filePath, String ranSeq, int blksize); §FileClient // Methods public void close(); §close public int length(); §length public int read(); §read1 public int read(byte[] b, int len); §read2 public boolean readBoolean(); §readBoolean public byte readByte(); §readByte public char readChar(); §readChar public double readDouble(); §readDouble public float readFloat(); §readFloat public int readFully(byte[] b); §readFully1 public int readFully(byte[] b, int off, int len); §readFully2 public int readInt(); §readInt public long readLong(); §readLong public String readLine(); §readLine public short readShort(); §readShort public String readUTF(); §readUTF public void seek(long pos); §seek }This class is a collection of methods corresponding to the DataInputStream and RandomAccessFile methods which send appropriate syntax to FileServer, receive the results and convert them to the appropriate types. It manages a single file for a specific HostClient.
public FileClient(HostClient host, String filePath, String ranSeq, int blksize)
host
-
the HostClient object for the host
filePath
-
the directory path, within /course/cs420/data/, for the file to be used
ranSeq
-
either "RAN" for RandomAccessFile or "SEQ"
blksize
-
the blocksize for the SEQuential file
public void close()
public int length()
public int read()
public int read()
b
-
output: the byte array containing the result
len
-
the number of bytes requested to be read
public boolean readBoolean()
public byte readByte()
public char readChar()
public double readDouble()
public float readFloat()
public int readFully(byte[] b)
b
-
output: the byte array containing the result
public int readFully(byte[] b, int off, int len)
b
-
output: the byte array containing the result
off
-
the offset in the file of the first byte to be read
len
-
the number of bytes requested to be read
public int readInt()
public long readLong()
public String readLine()
public short readShort()
public String readUTF()
public void seek(long pos)
pos
-
the byte position in the file where the next I/O will start (RAN only).