public void writeString(String str) throws IOException {
  if (str == null)   writeInt(0);
 else {
    if (useCompression && str.length() >= Compressor.MIN_SIZE_FOR_DEFLATION) {
      byte[] bytes=compressor.deflateString2ByteArray(str);
      writeInt(-bytes.length);
      outs.write(bytes,0,bytes.length);
      position+=bytes.length;
    }
 else {
      byte[] bytes=str.getBytes("UTF-8");
      writeInt(bytes.length);
      outs.write(bytes,0,bytes.length);
      position+=bytes.length;
    }
  }
}

public void writeString ( String str ) throws IOException { if ( str == null ) writeInt ( 0 ) ; else { if ( useCompression && str . length ( ) >= Compressor . MIN_SIZE_FOR_DEFLATION ) { byte [ ] bytes = compressor . deflateString2ByteArray ( str ) ; writeInt ( - bytes . length ) ; outs . write ( bytes , 0 , bytes . length ) ; position += bytes . length ; } else { byte [ ] bytes = str . getBytes ( "UTF-8" ) ; writeInt ( bytes . length ) ; outs . write ( bytes , 0 , bytes . length ) ; position += bytes . length ; } } }
write a string , compressed , if long enough
