| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TelnetPrintStream |
|
| 1.0909090909090908;1.091 |
| 1 | /** | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * 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 | */ | |
| 17 | package org.apache.xbean.terminal.telnet; | |
| 18 | ||
| 19 | import java.io.OutputStream; | |
| 20 | import java.io.PrintStream; | |
| 21 | ||
| 22 | public class TelnetPrintStream extends PrintStream { | |
| 23 | 0 | private final byte[] CRLF = new byte[]{(byte) '\r', (byte) '\n'}; |
| 24 | ||
| 25 | public TelnetPrintStream(OutputStream out) { | |
| 26 | 0 | super(out); |
| 27 | 0 | } |
| 28 | ||
| 29 | public void println() { | |
| 30 | 0 | newLine(); |
| 31 | 0 | } |
| 32 | ||
| 33 | public void println(String x) { | |
| 34 | 0 | synchronized (this) { |
| 35 | 0 | print(x); |
| 36 | 0 | newLine(); |
| 37 | 0 | } |
| 38 | 0 | } |
| 39 | ||
| 40 | public void println(long x) { | |
| 41 | 0 | synchronized (this) { |
| 42 | 0 | print(x); |
| 43 | 0 | newLine(); |
| 44 | 0 | } |
| 45 | 0 | } |
| 46 | ||
| 47 | public void println(char x) { | |
| 48 | 0 | synchronized (this) { |
| 49 | 0 | print(x); |
| 50 | 0 | newLine(); |
| 51 | 0 | } |
| 52 | 0 | } |
| 53 | ||
| 54 | public void println(boolean x) { | |
| 55 | 0 | synchronized (this) { |
| 56 | 0 | print(x); |
| 57 | 0 | newLine(); |
| 58 | 0 | } |
| 59 | 0 | } |
| 60 | ||
| 61 | public void println(float x) { | |
| 62 | 0 | synchronized (this) { |
| 63 | 0 | print(x); |
| 64 | 0 | newLine(); |
| 65 | 0 | } |
| 66 | 0 | } |
| 67 | ||
| 68 | public void println(double x) { | |
| 69 | 0 | synchronized (this) { |
| 70 | 0 | print(x); |
| 71 | 0 | newLine(); |
| 72 | 0 | } |
| 73 | 0 | } |
| 74 | ||
| 75 | public void println(int x) { | |
| 76 | 0 | synchronized (this) { |
| 77 | 0 | print(x); |
| 78 | 0 | newLine(); |
| 79 | 0 | } |
| 80 | 0 | } |
| 81 | ||
| 82 | public void println(char x[]) { | |
| 83 | 0 | synchronized (this) { |
| 84 | 0 | print(x); |
| 85 | 0 | newLine(); |
| 86 | 0 | } |
| 87 | 0 | } |
| 88 | ||
| 89 | private void newLine() { | |
| 90 | try { | |
| 91 | 0 | this.write(CRLF); |
| 92 | 0 | } catch (Exception e) { |
| 93 | 0 | } |
| 94 | 0 | } |
| 95 | } |