~psmay/+junk/java-iomux

« back to all changes in this revision

Viewing changes to src/us/wxy/iomux/FixedByteArrayFifo.java

  • Committer: Peter S. May
  • Date: 2013-04-11 02:08:47 UTC
  • Revision ID: peter_s._may_httppsmay.com-20130411020847-vkluuvq9nwnivk8j
Added getInputStream() for BlockingFifo.
BlockingFifo now limited to wrapping FlexByteFifo.
Available size counts for the fixed and flex fifos.

Show diffs side-by-side

added added

removed removed

Lines of Context:
258
258
  }
259
259
 
260
260
  /**
 
261
   * Returns number of bytes available for read.
 
262
   * 
 
263
   * @return Number of bytes available for read
 
264
   */
 
265
  public int availableForRead() {
 
266
    return writeLoc - readLoc;
 
267
  }
 
268
 
 
269
  /**
 
270
   * Returns number of bytes available for write.
 
271
   * 
 
272
   * @return Number of bytes available for write
 
273
   */
 
274
  public int availableForWrite() {
 
275
    return block.length - writeLoc;
 
276
  }
 
277
 
 
278
  /**
261
279
   * A fifo with zero space, with all operations hardcoded as zero-length no-ops.
262
280
   */
263
281
  public static final FixedByteArrayFifo EMPTY = new FixedByteArrayFifo(null) {
331
349
    public boolean writeEnd() {
332
350
      return true;
333
351
    }
 
352
 
 
353
    @Override
 
354
    public int availableForRead() {
 
355
      return 0;
 
356
    }
 
357
 
 
358
    @Override
 
359
    public int availableForWrite() {
 
360
      return 0;
 
361
    }
334
362
  };
335
363
 
336
364
}