1 45 package org.openejb.server.telnet; 46 47 import java.io.OutputStream ; 48 import java.io.PrintStream ; 49 50 public class TelnetPrintStream extends PrintStream { 51 52 private final byte[] CRLF = new byte[]{(byte) '\r',(byte) '\n'}; 53 54 public TelnetPrintStream(OutputStream out){ 55 super(out); 56 } 57 58 public void println() { 59 newLine(); 60 } 61 public void println(String x) { 62 synchronized (this) { 63 print(x); 64 newLine(); 65 } 66 } 67 public void println(long x) { 68 synchronized (this) { 69 print(x); 70 newLine(); 71 } 72 } 73 public void println(char x) { 74 synchronized (this) { 75 print(x); 76 newLine(); 77 } 78 } 79 public void println(boolean x) { 80 synchronized (this) { 81 print(x); 82 newLine(); 83 } 84 } 85 public void println(float x) { 86 synchronized (this) { 87 print(x); 88 newLine(); 89 } 90 } 91 public void println(double x) { 92 synchronized (this) { 93 print(x); 94 newLine(); 95 } 96 } 97 public void println(int x) { 98 synchronized (this) { 99 print(x); 100 newLine(); 101 } 102 } 103 public void println(char x[]) { 104 synchronized (this) { 105 print(x); 106 newLine(); 107 } 108 } 109 private void newLine() { 110 try { 111 this.write(CRLF); 112 } catch ( Exception e ) { 113 } 114 } 115 } 116 | Popular Tags |