why InputStream.markSupported always return false [android]

Viewed 335
/**
 * Indicates whether this stream supports the {@code mark()} and
 * {@code reset()} methods. The default implementation returns 
 * {@code false}.
 *
 * @return always {@code false}.
 * @see #mark(int)
 * @see #reset()
 */
public boolean markSupported() {
    return false;
}


public void mark(int readlimit) {
    /* empty */
}

public synchronized void reset() throws IOException {
    throw new IOException();
}

The comments means markSupported() Indicates whether this stream supports the mark() and reset() methods.

But it always return false.

Link between them is how to produce ?

Thanks

1 Answers

As @Mike explained, the abstract class InputStream itself does not support mark, but the subclasses which extend InputStream will @Override the methods you posted in your question.

InputStreams such as BufferedInputStream support marking, and overrides mark(), markSupported() and reset() methods.

Related