Chat
Class FileTransfer
java.lang.Object
|
+--Chat.FileTransfer
- class FileTransfer
- extends java.lang.Object
Encodes/decodes disk files using a BASE64 encoding. This approach to file
tranfer is enforced by ascii-based communication protocol of the application.
Field Summary |
static int |
MAXSIZE
A file size limit, in bytes. |
Method Summary |
(package private) static void |
decode(java.lang.String name,
java.io.BufferedReader in,
int size)
Decodes the stream in and writes the data to file.
|
(package private) static void |
encode(java.lang.String name,
java.io.PrintWriter out)
Reads contents of file specified, encodes it and writes it
out to the out stream. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
MAXSIZE
public static final int MAXSIZE
- A file size limit, in bytes.
FileTransfer
FileTransfer()
encode
static void encode(java.lang.String name,
java.io.PrintWriter out)
throws java.io.IOException
- Reads contents of file specified, encodes it and writes it
out to the
out
stream.
- Parameters:
name
- the file name.out
- output characted stream.
decode
static void decode(java.lang.String name,
java.io.BufferedReader in,
int size)
throws java.io.IOException
- Decodes the stream
in
and writes the data to file.
Checks the file size against size
.
- Parameters:
name
- the file name.in
- input characted stream.size
- expected file size.