@Override public int read(byte[] b, int off, int len) throws IOException { // System.out.println("Reading data "+len); synchronized (lock) { while (byteRingBuffer.getUsed() < len) { // System.out.println("trying to read data"); try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } return byteRingBuffer.read(b, 0, len); }
@Override public synchronized void reset() throws IOException { int len; synchronized (lock) { byteRingBuffer.clear(); } }
@Override public int available() throws IOException { return byteRingBuffer.getFree(); }