public void writeByteStream(InputStream is) throws IOException {
  writeByteBufferStart();
  if (_byteBuffer == null)   _byteBuffer=new byte[1024];
  byte[] buffer=_byteBuffer;
  int len;
  while ((len=is.read(buffer,0,buffer.length)) > 0) {
    if (len < buffer.length) {
      int len2=is.read(buffer,len,buffer.length - len);
      if (len2 < 0) {
        writeByteBufferEnd(buffer,0,len);
        return;
      }
      len+=len2;
    }
    writeByteBufferPart(buffer,0,len);
  }
  writeByteBufferEnd(buffer,0,0);
}

public void writeByteStream ( InputStream is ) throws IOException { writeByteBufferStart ( ) ; if ( _byteBuffer == null ) _byteBuffer = new byte [ 1024 ] ; byte [ ] buffer = _byteBuffer ; int len ; while ( ( len = is . read ( buffer , 0 , buffer . length ) ) > 0 ) { if ( len < buffer . length ) { int len2 = is . read ( buffer , len , buffer . length - len ) ; if ( len2 < 0 ) { writeByteBufferEnd ( buffer , 0 , len ) ; return ; } len += len2 ; } writeByteBufferPart ( buffer , 0 , len ) ; } writeByteBufferEnd ( buffer , 0 , 0 ) ; }
writes a full output stream .
