| 11 | package java.io; |
| 12 | |
| 13 | public abstract class InputStream implements Closeable { |
| 14 | public abstract int read() throws IOException; |
| 15 | |
| 16 | public int read(byte[] buffer) throws IOException { |
| 17 | return read(buffer, 0, buffer.length); |
| 18 | } |
| 19 | |
| 20 | public int read(byte[] buffer, int offset, int length) throws IOException { |
| 21 | for (int i = 0; i < length; ++i) { |
| 22 | int c = read(); |
| 23 | if (c == -1) { |
| 24 | if (i == 0) { |
| 25 | return -1; |
| 26 | } else { |
| 27 | return i; |
| 28 | } |
| 29 | } else { |
| 30 | buffer[offset + i] = (byte) (c & 0xFF); |
| 31 | } |
| 32 | } |
| 33 | return length; |
| 34 | } |
| 35 | |
| 36 | public long skip(long count) throws IOException { |
| 37 | final long Max = 8 * 1024; |
| 38 | int size = (int) (count < Max ? count : Max); |
| 39 | byte[] buffer = new byte[size]; |
| 40 | long remaining = count; |
| 41 | int c; |
| 42 | while ((c = read(buffer, 0, (int) (size < remaining ? size : remaining))) |
| 43 | >= 0 |
| 44 | && remaining > 0) { |
| 45 | remaining -= c; |
| 46 | } |
| 47 | return count - remaining; |
| 48 | } |
| 49 | |
| 50 | public int available() throws IOException { |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | public void mark(int limit) { |
| 55 | // ignore |
| 56 | } |
| 57 | |
| 58 | public void reset() throws IOException { |
| 59 | throw new IOException("mark/reset not supported"); |
| 60 | } |
| 61 | |
| 62 | public boolean markSupported() { |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | public void close() throws IOException { } |
| 67 | } |
nothing calls this directly
no outgoing calls
no test coverage detected