예제 #1
0
 /**
  * Executes the specified command.
  *
  * @param cmd command to be executed
  * @throws IOException I/O exception
  */
 private void execute(final Command cmd) throws IOException {
   log.write(this, cmd + " [...]");
   final DecodingInput di = new DecodingInput(in);
   try {
     cmd.setInput(di);
     cmd.execute(context);
     success(cmd.info());
   } catch (final BaseXException ex) {
     di.flush();
     error(ex.getMessage());
   }
 }
예제 #2
0
 /**
  * Retrieves data from the server.
  *
  * @param bi buffered server input
  * @param os output stream
  * @throws IOException I/O exception
  */
 protected static void receive(final BufferInput bi, final OutputStream os) throws IOException {
   final DecodingInput di = new DecodingInput(bi);
   for (int b; (b = di.read()) != -1; ) os.write(b);
 }