All pastes #344786 Raw Edit

Something

public text v1 · immutable
·published 2007-02-08 00:39 UTC
rendered paste body
public class ReaderInputStream extends InputStream {
  private Reader fReader;

  public ReaderInputStream(Reader reader) {
    fReader = reader;
  }

  @Override
  public int read() throws IOException {
    return fReader.read();
  }

  @Override
  public void close() throws IOException {
    fReader.close();
  }

  @Override
  public synchronized void mark(int readlimit) {
    try {
      fReader.mark(readlimit);
    } catch (IOException e) {
      /* Ignore */
    }
  }

  @Override
  public boolean markSupported() {
    return fReader.markSupported();
  }

  @Override
  public synchronized void reset() throws IOException {
    fReader.reset();
  }

  @Override
  public long skip(long n) throws IOException {
    return fReader.skip(n);
  }
}