1 /* 2 * $Id: FastByteArrayOutputStream.java,v 1.1 2001/12/21 06:50:10 lhoriman Exp $ 3 * $Source: /cvsroot/mav/maverick/src/java/org/infohazard/maverick/util/FastByteArrayOutputStream.java,v $ 4 */ 5 6 package org.infohazard.maverick.util; 7 8 import java.io.*; 9 10 /** 11 * Allows us to convert this into a ByteArrayInputStream without copying the 12 * buffer. Just make sure you are finished writing first. 13 */ 14 public class FastByteArrayOutputStream extends ByteArrayOutputStream 15 { 16 /** You should be done writing before you call this method. */ 17 public ByteArrayInputStream getInputStream() 18 { 19 // Be careful to limit the size of the buffer otherwise you get 20 // nulls at the end of the input stream. 21 return new ByteArrayInputStream(this.buf, 0, this.size()); 22 } 23 } 24