|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAudioSegment
public class AudioSegment
Associates audio data with a representation of the audio format.
The format of the audio data is described by a media locator String
.
Use getMediaLocator
to get the format.
Media locators are described in the AudioManager
.
Examples of media locators include:
"stream://audio?encoding=pcm&rate=11025&bits=16&channels=1"
"resource:/org/example/audio.wav"
Audio data may be provided by subclasses that override the
openInputStream
method.
Some implementations may limit the capability to get the audio data
as indicated by isGettable
.
Implementations will return a subclass of this class that
checks security settings as documented in openInputStream
.
This class does not check security settings when used directly.
openInputStream
,
getMediaLocator
,
isGettable
,
AudioManager
Constructor Summary | |
---|---|
AudioSegment(String locator,
String markupText)
Constructs an AudioSegment from the resource indicated
by the given media locator . |
Method Summary | |
---|---|
String |
getMarkupText()
Returns the alternate markup text that may be used in case there is a problem with the audio for this AudioSegment . |
String |
getMediaLocator()
Returns the media locator for this AudioSegment . |
boolean |
isGettable()
Indicates that a openInputStream request will not
throw a SecurityException . |
InputStream |
openInputStream()
Returns an InputStream that can be used to read this
AudioSegment 's contents. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AudioSegment(String locator, String markupText) throws IllegalArgumentException
AudioSegment
from the resource indicated
by the given media locator
.
The media locator
defines the format and location of the data
as described in the AudioManager
.
The markupText
may be used in case there is a problem with the
audio data.
The following example shows how to speak audio from a URL:
Synthesizer synth = ... // see Synthesizer for creation options
synth.allocate();
AudioSegment audio =
new AudioSegment("http://www.example.org/audio.wav",
"<speak xml:lang='en-US' version='1.0'>" +
"My name is Smith" +
"</speak>");
synth.speak(audio, null); // speak
locator
- a non-null
media locator descriptionmarkupText
- the alternate markup text
IllegalArgumentException
- if an invalid parameter value is specifiedopenInputStream
,
getMediaLocator
,
getMarkupText
,
AudioManager
Method Detail |
---|
public String getMediaLocator()
AudioSegment
.
This locator specifies characteristics about this AudioSegment
including the sample rate and encoding.
If openInputStream
returns null, then the locator must also
encode information used to determine how to obtain the data
(e.g., a "resource:"
or "http:"
locator).
openInputStream
,
getMarkupText
,
AudioManager
public String getMarkupText()
AudioSegment
.
AudioSegment
openInputStream
,
getMediaLocator
public InputStream openInputStream() throws IOException, SecurityException
InputStream
that can be used to read this
AudioSegment
's contents.
The media locator returned by getMediaLocator
defines
the format of the data.
null
is returned unless this method is overridden by a subclass.
A SecurityException
is not thrown if isGettable
returns true
.
InputStream
pointing to the beginning of the
AudioSegment
's data
IOException
- if an I/O error occurs
SecurityException
- if the application does not have permissionisGettable
,
getMediaLocator
,
getMarkupText
javax.speech.AudioSegment.openInputStream
public boolean isGettable()
openInputStream
request will not
throw a SecurityException
.
This method always returns true
unless overridden by a subclass.
true
if access is allowed to this audio datagetMediaLocator
,
openInputStream
|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API 2.0,
Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.