public static void write(OutputStream out,InputStream is,long length,boolean noBackslashEscapes) throws IOException {
  out.write(QUOTE);
  byte[] buffer=new byte[1024];
  long bytesLeft=length;
  int len;
  for (; ; ) {
    int bytesToRead=(int)Math.min(bytesLeft,buffer.length);
    if (bytesToRead == 0) {
      break;
    }
    len=is.read(buffer,0,bytesToRead);
    if (len <= 0) {
      break;
    }
    writeBytesEscaped(out,buffer,len,noBackslashEscapes);
    bytesLeft-=len;
  }
  out.write(QUOTE);
}

public static void write ( OutputStream out , InputStream is , long length , boolean noBackslashEscapes ) throws IOException { out . write ( QUOTE ) ; byte [ ] buffer = new byte [ 1024 ] ; long bytesLeft = length ; int len ; for ( ; ; ) { int bytesToRead = ( int ) Math . min ( bytesLeft , buffer . length ) ; if ( bytesToRead == 0 ) { break ; } len = is . read ( buffer , 0 , bytesToRead ) ; if ( len <= 0 ) { break ; } writeBytesEscaped ( out , buffer , len , noBackslashEscapes ) ; bytesLeft -= len ; } out . write ( QUOTE ) ; }
write stream in text format .
