com.tuneology.avm.media
Class AudioData

java.lang.Object
  |
  +--com.tuneology.avm.media.AudioData
All Implemented Interfaces:
MediaData

public class AudioData
extends java.lang.Object
implements MediaData

This class presents an audio file or stream as a pure data stream, stripping off the header, and making its information available in a format-independent manner.


Constructor Summary
AudioData(AudioProperties p, MediaData f)
          Create a new file with the desired properties.
AudioData(MediaData f)
          Reads an existing file.
 
Method Summary
 boolean canSeek()
          Returns true if the file is capable of seeking.
 void close()
           
 java.io.File getFile()
          Returns a File object by which the contents can be read.
 long getFilePointer()
          Returns the current position in the file.
 java.lang.String getPath()
          Returns the pathname of the file if it has one, blank otherwise.
 MediaProperties getProperties()
           
 boolean isStream()
          Returns true if the source is a stream of indefinate length.
 long length()
          Returns the length of the file.
 int read(byte[] b, int off, int len)
          Returns raw data from the source, skipping over the header.
 void releaseFile(java.io.File f)
          Deletes the contents of the file if it's a temp file.
 void seek(long pos)
          Moves the current position in the file.
 void setLength(long newLength)
           
 void write(byte[] b, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioData

public AudioData(MediaData f)
          throws java.io.IOException
Reads an existing file.

AudioData

public AudioData(AudioProperties p,
                 MediaData f)
          throws java.io.IOException
Create a new file with the desired properties.
Method Detail

getProperties

public MediaProperties getProperties()
Specified by:
getProperties in interface MediaData

getFile

public java.io.File getFile()
                     throws java.io.IOException
Returns a File object by which the contents can be read. This can be a temporary file, if necessary. Not allowed if the source is a stream.
Specified by:
getFile in interface MediaData
Throws:
java.io.IOException -  

getPath

public java.lang.String getPath()
Description copied from interface: MediaData
Returns the pathname of the file if it has one, blank otherwise.
Specified by:
getPath in interface MediaData
Following copied from interface: com.tuneology.avm.media.MediaData
Returns:
the pathname of the file if it has one, blank otherwise.

releaseFile

public void releaseFile(java.io.File f)
                 throws java.io.IOException
Deletes the contents of the file if it's a temp file.
Specified by:
releaseFile in interface MediaData
Throws:
java.io.IOException -  

isStream

public boolean isStream()
Returns true if the source is a stream of indefinate length.
Specified by:
isStream in interface MediaData
Returns:
true if the source is a stream of indefinate length.

length

public long length()
            throws java.io.IOException
Returns the length of the file.
Specified by:
length in interface MediaData
Returns:
the length of the file.
Throws:
java.io.IOException -  

canSeek

public boolean canSeek()
Returns true if the file is capable of seeking.
Specified by:
canSeek in interface MediaData

seek

public void seek(long pos)
          throws java.io.IOException
Moves the current position in the file.
Specified by:
seek in interface MediaData
Parameters:
pos - the new current position.
Throws:
java.io.IOException -  

getFilePointer

public long getFilePointer()
                    throws java.io.IOException
Returns the current position in the file.
Specified by:
getFilePointer in interface MediaData
Returns:
the current position in the file.
Throws:
java.io.IOException -  

setLength

public void setLength(long newLength)
               throws java.io.IOException
Specified by:
setLength in interface MediaData
Parameters:
newLength -  
Throws:
java.io.IOException -  

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Returns raw data from the source, skipping over the header.
Specified by:
read in interface MediaData
Parameters:
b -  
off -  
len -  
Throws:
java.io.IOException -  

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in interface MediaData
Throws:
java.io.IOException -  

close

public void close()
           throws java.io.IOException
Specified by:
close in interface MediaData
Throws:
java.io.IOException -