MCPcopy Create free account
hub / github.com/davidgiven/luje / InputStream

Class InputStream

lib/java/io/InputStream.java:38–237  ·  view source on GitHub ↗

The base class for all input streams. An input stream is a means of reading data from a source in a byte-wise manner. Some input streams also support marking a position in the input stream and returning to this position later. This abstract class does not provide a fully working implementation,

Source from the content-addressed store, hash-verified

36 * @see OutputStream
37 */
38public abstract class InputStream extends Object implements Closeable {
39
40 private static byte[] skipBuf;
41
42 /**
43 * This constructor does nothing. It is provided for signature
44 * compatibility.
45 */
46 public InputStream() {
47 /* empty */
48 }
49
50 /**
51 * Returns the number of bytes that are available before this stream will
52 * block. This implementation always returns 0. Subclasses should override
53 * and indicate the correct number of bytes available.
54 *
55 * @return the number of bytes available before blocking.
56 * @throws IOException
57 * if an error occurs in this stream.
58 */
59 public int available() throws IOException {
60 return 0;
61 }
62
63 /**
64 * Closes this stream. Concrete implementations of this class should free
65 * any resources during close. This implementation does nothing.
66 *
67 * @throws IOException
68 * if an error occurs while closing this stream.
69 */
70 public void close() throws IOException {
71 /* empty */
72 }
73
74 /**
75 * Sets a mark position in this InputStream. The parameter {@code readlimit}
76 * indicates how many bytes can be read before the mark is invalidated.
77 * Sending {@code reset()} will reposition the stream back to the marked
78 * position provided {@code readLimit} has not been surpassed.
79 * <p>
80 * This default implementation does nothing and concrete subclasses must
81 * provide their own implementation.
82 *
83 * @param readlimit
84 * the number of bytes that can be read from this stream before
85 * the mark is invalidated.
86 * @see #markSupported()
87 * @see #reset()
88 */
89 public void mark(int readlimit) {
90 /* empty */
91 }
92
93 /**
94 * Indicates whether this stream supports the {@code mark()} and
95 * {@code reset()} methods. The default implementation returns {@code false}.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected