Exemplo n.º 1
0
 @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);
 }
Exemplo n.º 2
0
 @Override
 public synchronized void reset() throws IOException {
   int len;
   synchronized (lock) {
     byteRingBuffer.clear();
   }
 }
Exemplo n.º 3
0
 @Override
 public int available() throws IOException {
   return byteRingBuffer.getFree();
 }