| 24 | import java.lang.reflect.Modifier; |
| 25 | |
| 26 | public class LegacyObjectInputStream extends InputStream { |
| 27 | private final InputStream in; |
| 28 | private final PushbackReader r; |
| 29 | |
| 30 | public LegacyObjectInputStream(InputStream in) { |
| 31 | this.in = in; |
| 32 | this.r = new PushbackReader(new InputStreamReader(in)); |
| 33 | } |
| 34 | |
| 35 | public int read() throws IOException { |
| 36 | return in.read(); |
| 37 | } |
| 38 | |
| 39 | public int read(byte[] b, int offset, int length) throws IOException { |
| 40 | return in.read(b, offset, length); |
| 41 | } |
| 42 | |
| 43 | public void close() throws IOException { |
| 44 | in.close(); |
| 45 | } |
| 46 | |
| 47 | public Object readObject() throws IOException, ClassNotFoundException { |
| 48 | return readObject(new HashMap<Integer, Object>()); |
| 49 | } |
| 50 | |
| 51 | public boolean readBoolean() throws IOException { |
| 52 | read('z'); |
| 53 | return readLongToken() != 0; |
| 54 | } |
| 55 | |
| 56 | public byte readByte() throws IOException { |
| 57 | read('b'); |
| 58 | return (byte) readLongToken(); |
| 59 | } |
| 60 | |
| 61 | public char readChar() throws IOException { |
| 62 | read('c'); |
| 63 | return (char) readLongToken(); |
| 64 | } |
| 65 | |
| 66 | public short readShort() throws IOException { |
| 67 | read('s'); |
| 68 | return (short) readLongToken(); |
| 69 | } |
| 70 | |
| 71 | public int readInt() throws IOException { |
| 72 | read('i'); |
| 73 | return (int) readLongToken(); |
| 74 | } |
| 75 | |
| 76 | public long readLong() throws IOException { |
| 77 | read('j'); |
| 78 | return readLongToken(); |
| 79 | } |
| 80 | |
| 81 | public float readFloat() throws IOException { |
| 82 | read('f'); |
| 83 | return (float) readDoubleToken(); |
nothing calls this directly
no outgoing calls
no test coverage detected