Logo Search packages:      
Sourcecode: yydebug version File versions  Download package

synchronized int jay::yydebug::yyJInputStream::read (  )  throws IOException [inline]

byte[] buf = queue.get(0);

Definition at line 42 of file yyJInputStream.java.

References queue.

                                                     {
      if (queue == null) throw new IOException("closed");
      while (queue.isEmpty())
        try {
            wait();
        } catch (InterruptedException ie) {
            throw new IOException("interrupted");
        }

      /// byte[] buf = queue.get(0);
      byte[] buf = (byte[])queue.get(0);
      switch (buf.length) {
      case 0:
        return -1;
      case 1:
        queue.remove(0);
        break;
      default:
        byte[] nbuf = new byte[buf.length-1];
        System.arraycopy(buf, 1, nbuf, 0, nbuf.length);
        queue.set(0, nbuf); notifyAll(); // others could be waiting...
      }
      return buf[0] & 255;
  }


Generated by  Doxygen 1.6.0   Back to index