com.gemstone.org.jgroups.util.ExposedBufferedInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-jgroups Show documentation
Show all versions of gemfire-jgroups Show documentation
SnappyData store based off Pivotal GemFireXD
The newest version!
/** Notice of modification as required by the LGPL
* This file was modified by Gemstone Systems Inc. on
* $Date$
**/
package com.gemstone.org.jgroups.util;
import com.gemstone.org.jgroups.util.GemFireTracer;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author Bela Ban
* @version $Id: ExposedBufferedInputStream.java,v 1.3 2005/07/25 16:57:31 belaban Exp $
*/
public class ExposedBufferedInputStream extends BufferedInputStream {
private final static GemFireTracer log=GemFireTracer.getLog(ExposedBufferedInputStream.class);
/**
* Creates a BufferedInputStream
* and saves its argument, the input stream
* in
, for later use. An internal
* buffer array is created and stored in buf
.
*
* @param in the underlying input stream.
*/
public ExposedBufferedInputStream(InputStream in) {
super(in);
}
/**
* Creates a BufferedInputStream
* with the specified buffer size,
* and saves its argument, the input stream
* in
, for later use. An internal
* buffer array of length size
* is created and stored in buf
.
*
* @param in the underlying input stream.
* @param size the buffer size.
* @throws IllegalArgumentException if size <= 0.
*/
public ExposedBufferedInputStream(InputStream in, int size) {
super(in, size);
}
public void reset(int size) {
count=pos=marklimit=0;
markpos=-1;
if(buf != null) {
if(size > buf.length) {
buf=new byte[size];
}
}
else {
buf=new byte[4096];
if(log.isWarnEnabled())
log.warn("output stream was closed, re-creating it (please don't close it)");
}
}
}