Example #1
0
 public final void writeASCII(String s) throws IOException {
   if (Thread.currentThread().isInterrupted()) throw new InterruptedIOException();
   OutputStream os = getOutputStream();
   synchronized (os) {
     if (Defines.DEBUG && CAT.isDebugEnabled()) CAT.debug("C: " + s);
     os.write(s.getBytes("ASCII"));
     os.write((byte) 13);
     os.write((byte) 10);
     os.flush();
   }
 }
Example #2
0
 /**
  * UTF byte count is appended to the asciiPrefix, then UTF bytes are appended to the result; the
  * final result is sent.
  */
 public final void writeMSG(String asciiPrefix, String msgBody) throws IOException {
   if (Thread.currentThread().isInterrupted()) throw new InterruptedIOException();
   OutputStream os = getOutputStream();
   synchronized (os) {
     byte[] utfBytes = msgBody.getBytes("UTF-8");
     asciiPrefix = asciiPrefix + ' ' + utfBytes.length;
     if (Defines.DEBUG && CAT.isDebugEnabled()) CAT.debug("C: " + asciiPrefix + "\r\n" + msgBody);
     os.write(asciiPrefix.getBytes("ASCII"));
     os.write((byte) 13);
     os.write((byte) 10);
     os.write(utfBytes);
     os.flush();
   }
 }
Example #3
0
 public final void flush() throws IOException, MessagingNetworkException {
   OutputStream os = getOutputStream();
   synchronized (os) {
     os.flush();
   }
 }