| 21 | import java.io.NotSerializableException; |
| 22 | |
| 23 | public class LegacyObjectOutputStream extends OutputStream { |
| 24 | private final PrintStream out; |
| 25 | |
| 26 | public LegacyObjectOutputStream(OutputStream out) { |
| 27 | this.out = new PrintStream(out); |
| 28 | } |
| 29 | |
| 30 | public void write(int c) throws IOException { |
| 31 | out.write(c); |
| 32 | } |
| 33 | |
| 34 | public void write(byte[] b, int offset, int length) throws IOException { |
| 35 | out.write(b, offset, length); |
| 36 | } |
| 37 | |
| 38 | public void flush() throws IOException { |
| 39 | out.flush(); |
| 40 | } |
| 41 | |
| 42 | public void close() throws IOException { |
| 43 | out.close(); |
| 44 | } |
| 45 | |
| 46 | public void writeObject(Object o) throws IOException { |
| 47 | writeObject(o, new IdentityHashMap(), new int[] {0}); |
| 48 | } |
| 49 | |
| 50 | public void writeBoolean(boolean v) { |
| 51 | out.print("z"); |
| 52 | out.print((v ? 1 : 0)); |
| 53 | } |
| 54 | |
| 55 | public void writeByte(byte v) { |
| 56 | out.print("b"); |
| 57 | out.print((int) v); |
| 58 | } |
| 59 | |
| 60 | public void writeChar(char v) { |
| 61 | out.print("c"); |
| 62 | out.print((int) v); |
| 63 | } |
| 64 | |
| 65 | public void writeShort(short v) { |
| 66 | out.print("s"); |
| 67 | out.print((int) v); |
| 68 | } |
| 69 | |
| 70 | public void writeInt(int v) { |
| 71 | out.print("i"); |
| 72 | out.print(v); |
| 73 | } |
| 74 | |
| 75 | public void writeLong(long v) { |
| 76 | out.print("j"); |
| 77 | out.print(v); |
| 78 | } |
| 79 | |
| 80 | public void writeFloat(float v) { |
nothing calls this directly
no outgoing calls
no test coverage detected