01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.server.telnet;
17:
18: import java.io.OutputStream;
19: import java.io.PrintStream;
20:
21: public class TelnetPrintStream extends PrintStream {
22:
23: private final byte[] CRLF = new byte[] { (byte) '\r', (byte) '\n' };
24:
25: public TelnetPrintStream(OutputStream out) {
26: super (out);
27: }
28:
29: public void println() {
30: newLine();
31: }
32:
33: public void println(String x) {
34: synchronized (this ) {
35: print(x);
36: newLine();
37: }
38: }
39:
40: public void println(long x) {
41: synchronized (this ) {
42: print(x);
43: newLine();
44: }
45: }
46:
47: public void println(char x) {
48: synchronized (this ) {
49: print(x);
50: newLine();
51: }
52: }
53:
54: public void println(boolean x) {
55: synchronized (this ) {
56: print(x);
57: newLine();
58: }
59: }
60:
61: public void println(float x) {
62: synchronized (this ) {
63: print(x);
64: newLine();
65: }
66: }
67:
68: public void println(double x) {
69: synchronized (this ) {
70: print(x);
71: newLine();
72: }
73: }
74:
75: public void println(int x) {
76: synchronized (this ) {
77: print(x);
78: newLine();
79: }
80: }
81:
82: public void println(char x[]) {
83: synchronized (this ) {
84: print(x);
85: newLine();
86: }
87: }
88:
89: private void newLine() {
90: try {
91: this .write(CRLF);
92: } catch (Exception e) {
93: }
94: }
95: }
|