org.mobicents.media.server.impl.resource.audio
Class RecorderCache

java.lang.Object
  extended by java.io.InputStream
      extended by org.mobicents.media.server.impl.resource.audio.RecorderCache
All Implemented Interfaces:
java.io.Closeable

public class RecorderCache
extends java.io.InputStream

Implements cache for recorded audio. Recorder implementation uses push(Buffer) method to fill the cache. Java Sound AudioSystem can access this cache as java.io.InputStream for constructing internal AudioInputStream. The cache is locked for reading until will be explicitly unblocked by Recorder.

Author:
Oleg Kulikov

Field Summary
protected  boolean blocked
           
protected  java.util.concurrent.Semaphore semaphore
           
 
Constructor Summary
RecorderCache()
           
 
Method Summary
 int available()
           
protected  void push(org.mobicents.media.Buffer buffer)
          Appends data from media buffer to the local buffer.
 int read()
           
protected  void unblock()
          Unblocks cache and allow reading from this cache.
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

semaphore

protected java.util.concurrent.Semaphore semaphore

blocked

protected volatile boolean blocked
Constructor Detail

RecorderCache

public RecorderCache()
Method Detail

available

public int available()
Overrides:
available in class java.io.InputStream

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

push

protected void push(org.mobicents.media.Buffer buffer)
Appends data from media buffer to the local buffer.

Parameters:
buffer - the buffer which contains media data

unblock

protected void unblock()
Unblocks cache and allow reading from this cache.



Copyright © 2010. All Rights Reserved.