org.faceless.pdf2
Class PDFSound

java.lang.Object
  extended by org.faceless.pdf2.PDFSound
All Implemented Interfaces:
Cloneable

public final class PDFSound
extends Object

A PDFSound represents an audio sample in a PDF document. Since 2.11.9 any audio stream that can be parsed by the Java sound subsystem can be used, however for ease of parsing we recommend PCM WAV.

Since:
1.1

Constructor Summary
PDFSound(InputStream in)
           Create a new PDFSound from the specified InputStream.
 
Method Summary
 void close()
          Close the sound object.
 AudioInputStream getAudioInputStream()
          Return an AudioInputStream of this object.
 Reader getMetaData()
          Return any XML metadata associated with this object.
 int getRate()
          Return the number of samples/second this sound is played at.
 InputStream getStream()
          Deprecated. please call getAudioInputStream instead.
 String getType()
          Deprecated. method will always return Unknown
 void setMetaData(String xmldata)
          Set the XML metadata associated with this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDFSound

public PDFSound(InputStream in)
         throws IOException

Create a new PDFSound from the specified InputStream. The stream can be any type of Audio file that is supported by the AudioSystem, or if that system is not enabled for any reason, PCM WAV formats can be parsed directly.

Throws:
IOException - if the file format is invalid
Method Detail

getRate

public int getRate()
Return the number of samples/second this sound is played at. Common values are 8000, 11025 or 22050

Since:
1.1.12

getAudioInputStream

public AudioInputStream getAudioInputStream()
Return an AudioInputStream of this object.

Since:
2.11.7

getType

public String getType()
Deprecated. method will always return Unknown

This method is deprecated and will always return "Unknown"


getStream

public InputStream getStream()
Deprecated. please call getAudioInputStream instead.

This method returns the raw samples of the audio, which is useless without the associated format details. Anyone using this method is strongly encouraged to call getAudioInputStream() instead.

Since:
2.2

setMetaData

public void setMetaData(String xmldata)
Set the XML metadata associated with this object. See PDF.setMetaData(java.lang.String) for more information.

Parameters:
xmldata - the XML data to embed into the document, or null to clear any existing metadata. No validation is performed on this input.
Since:
1.1.12

getMetaData

public Reader getMetaData()
                   throws IOException
Return any XML metadata associated with this object. See the PDF.getMetaData() for more information

Returns:
a Reader containing the source of the XML or null if no metadata is available.
Throws:
IOException - if the metadata can't be extracted
Since:
1.1.12

toString

public String toString()

close

public void close()
Close the sound object. This will prevent any further changes from being made to the object, but will potentially free up some resources as well.

Since:
2.2


Copyright © 2001-2010 Big Faceless Organization