- public void flush_output() {
- for (String s : pending_output)
- System.out.print(s);
- pending_output.clear();
+ public void add_binary(byte[] bytes, int len) throws InterruptedException {
+ byte[] dup = new byte[len];
+
+ if (debug)
+ System.out.printf ("\t\t\t\t\t%d:", len);
+ for(int i = 0; i < len; i++) {
+ dup[i] = bytes[i];
+ if (debug)
+ System.out.printf(" %02x", dup[i]);
+ }
+ if (debug)
+ System.out.printf("\n");
+
+ binary_queue.put(dup);
+ }
+
+ public synchronized void flush_output() {
+ if (pending_output == null)
+ return;
+ synchronized (pending_output) {
+ for (String s : pending_output)
+ System.out.print(s);
+ pending_output.clear();
+ }