1 package org.jgroups.util; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 6 import java.io.BufferedInputStream ; 7 import java.io.InputStream ; 8 9 13 public class ExposedBufferedInputStream extends BufferedInputStream { 14 private final static Log log=LogFactory.getLog(ExposedBufferedInputStream.class); 15 23 public ExposedBufferedInputStream(InputStream in) { 24 super(in); 25 } 26 27 39 public ExposedBufferedInputStream(InputStream in, int size) { 40 super(in, size); 41 } 42 43 public void reset(int size) { 44 count=pos=marklimit=0; 45 markpos=-1; 46 if(buf != null) { 47 if(size > buf.length) { 48 buf=new byte[size]; 49 } 50 } 51 else { 52 buf=new byte[4096]; 53 if(log.isWarnEnabled()) 54 log.warn("output stream was closed, re-creating it (please don't close it)"); 55 } 56 } 57 } 58 | Popular Tags |