/** * 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()); } }
/** * 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); }