All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ro.isdc.wro.util.io.UnclosableBufferedInputStream Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
/**
 * Copyright@2010 Alex Objelean
 */
package ro.isdc.wro.util.io;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * An input stream which allows to be read multiple times. The only condition is to call reset or close method after reading it.
 *
 * @author Alex Objelean
 * @created 18 Aug 2010
 */
public class UnclosableBufferedInputStream
    extends BufferedInputStream {

  public UnclosableBufferedInputStream(final InputStream in) {
    super(in);
    super.mark(Integer.MAX_VALUE);
  }

  public UnclosableBufferedInputStream(final byte[] bytes) {
    this (new ByteArrayInputStream(bytes));
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy