public static void copyString(Reader source,OutputStream target) throws IOException {
  char[] buff=new char[Constants.IO_BUFFER_SIZE];
  Data d=new Data(null,new byte[3 * Constants.IO_BUFFER_SIZE]);
  while (true) {
    int l=source.read(buff);
    if (l < 0) {
      break;
    }
    d.writeStringWithoutLength(buff,l);
    target.write(d.data,0,d.pos);
    d.reset();
  }
}

public static void copyString ( Reader source , OutputStream target ) throws IOException { char [ ] buff = new char [ Constants . IO_BUFFER_SIZE ] ; Data d = new Data ( null , new byte [ 3 * Constants . IO_BUFFER_SIZE ] ) ; while ( true ) { int l = source . read ( buff ) ; if ( l < 0 ) { break ; } d . writeStringWithoutLength ( buff , l ) ; target . write ( d . data , 0 , d . pos ) ; d . reset ( ) ; } }
copy a string from a reader to an output stream .
