Commit 9aafa234 authored by Matti Pulkkinen's avatar Matti Pulkkinen
Browse files

added comments to StreamHandler

parent 59a0c45b
......@@ -9,20 +9,43 @@ public class StreamHandler {
private ObjectInputStream ois;
private ObjectOutputStream oos;
/**
* Packs the parameters ois and oos into a StreamHandler object.
*
* @param ois The ObjectInputStream to be placed in this object.
* @param oos The ObjectOutputStream to be placed in this object.
*/
public StreamHandler(ObjectInputStream ois, ObjectOutputStream oos) {
this.ois = ois;
this.oos = oos;
} // StreamHandler(ObjectInputStream, ObjectOutputStream)
/**
* Closes the streams handled by this object.
*
* @throws IOException If closing one of the streams fails.
*/
void close() throws IOException {
this.ois.close();
this.oos.close();
} // close()
/**
* Reads an int from the input stream contained in this object.
*
* @return The int read from the stream.
* @throws IOException If reading from the stream fails.
*/
int readInt() throws IOException {
return this.ois.readInt();
} // readInt()
/**
* Write an int to the output stream contained in this object.
*
* @param n The int to be written out.
* @throws IOException If writing to the stream fails.
*/
void writeInt(int n) throws IOException {
this.oos.writeInt(n);
this.oos.flush();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment