示例#1
0
 @Override
 public void run() {
   try {
     OutputStream os = proc.getOutputStream();
     // PrintStream out = new PrintStream(new BufferedOutputStream(os));
     OutputStream out = new BufferedOutputStream(os);
     for (JsonValue sv : iter) {
       // TODO:  force jstrings here? add i/o layer here? add serialize function that has i/o
       // layer?
       JsonString s = (JsonString) sv;
       if (s != null) {
         // out.println(s.toString()); // TODO: PrintStream swallows IOExceptions...
         out.write(s.getInternalBytes(), s.bytesOffset(), s.bytesLength());
         out.write('\n');
       }
     }
     out.close();
   } catch (Throwable e) {
     if (error == null) {
       error = e;
     }
     proc.destroy();
   }
 }