Java Reference
In-Depth Information
try {
fServer.close ();
fServer = null;
}
catch (IOException e) {}
} // closeServer
/**
* The net input stream is wrappped in a
* DataInputStream so we can use readLine, readInt
* and readFloat methods.
**/
String readNetInputLine () {
try {
return fNetInputReader.readLine ();
}
catch (IOException e) {
return null;
}
} // readNetInputLine
/** Read an integer value from the socket stream **/
int readNetInputInt () throws IOException {
return fNetInputDataStream.readInt ();
} // readNetInputInt
/** Read float value from the socket stream. **/
float readNetInputFloat () throws IOException {
return fNetInputDataStream.readFloat ();
} // readNetInputFloat
/**
* The net output is a PrintWriter class which doesn't
* throw IOException itself. Instead we have to use
* the PrintWriter checkError() method and throw an
* exception ourselves if there was an output error.
**/
void writeNetOutputLine (String string) throws
IOException {
fPrintWriter.println (string);
if (fPrintWriter.checkError ())
throw new IOException ();
fPrintWriter.flush();
if (fPrintWriter.checkError ())
throw new IOException ();
} // writeNetOutputLine
} // class DataClientWorker
 
Search WWH ::




Custom Search