Code example for InputStream

Methods: mark

0
   *          the stream. If {@link #rewind()} is called after so many bytes are 
   *          read from the stream, {@link #rewind()} would fail. 
   */ 
  public RewindableInputStream(InputStream input, int maxBytesToRemember) {
    this.input = new BufferedInputStream(input, maxBytesToRemember);
    this.input.mark(maxBytesToRemember);
  } 
 
  @Override 
  public int read() throws IOException { 
    return input.read();
  } 
 
  @Override 
  public int read(byte[] buffer, int offset, int length) throws IOException {
    return input.read(buffer, offset, length);
  } 
 
  @Override 
  public void close() throws IOException { 
Contextual code suggestions in your IDE  Get Codota for Java