java.lang.Objectjava.io.InputStream
javax.sound.sampled.AudioInputStream
public class AudioInputStream
An audio input stream is an input stream with a specified audio format and length. The length is expressed in sample frames, not bytes. Several methods are provided for reading a certain number of bytes from the stream, or an unspecified number of bytes. The audio input stream keeps track of the last byte that was read. You can skip over an arbitrary number of bytes to get to a later position for reading. An audio input stream may support marks. When you set a mark, the current position is remembered so that you can return to it later.
The AudioSystem class includes many methods that manipulate
AudioInputStream objects.
For example, the methods let you:
AudioSystem,
Clip.open(AudioInputStream)| Field Summary | |
|---|---|
protected AudioFormat |
format
The format of the audio data contained in the stream. |
protected long |
frameLength
This stream's length, in sample frames. |
protected long |
framePos
The current position in this stream, in sample frames (zero-based). |
protected int |
frameSize
The size of each frame, in bytes. |
| Constructor Summary | |
|---|---|
AudioInputStream(InputStream stream,
AudioFormat format,
long length)
Constructs an audio input stream that has the requested format and length in sample frames, using audio data from the specified input stream. |
|
AudioInputStream(TargetDataLine line)
Constructs an audio input stream that reads its data from the target data line indicated. |
|
| Method Summary | |
|---|---|
int |
available()
Returns the maximum number of bytes that can be read (or skipped over) from this audio input stream without blocking. |
void |
close()
Closes this audio input stream and releases any system resources associated with the stream. |
AudioFormat |
getFormat()
Obtains the audio format of the sound data in this audio input stream. |
long |
getFrameLength()
Obtains the length of the stream, expressed in sample frames rather than bytes. |
void |
mark(int readlimit)
Marks the current position in this audio input stream. |
boolean |
markSupported()
Tests whether this audio input stream supports the mark and
reset methods. |
int |
read()
Reads the next byte of data from the audio input stream. |
int |
read(byte[] b)
Reads some number of bytes from the audio input stream and stores them into the buffer array b. |
int |
read(byte[] b,
int off,
int len)
Reads up to a specified maximum number of bytes of data from the audio stream, putting them into the given byte array. |
void |
reset()
Repositions this audio input stream to the position it had at the time its mark method was last invoked. |
long |
skip(long n)
Skips over and discards a specified number of bytes from this audio input stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AudioFormat format
protected long frameLength
protected int frameSize
protected long framePos
| Constructor Detail |
|---|
public AudioInputStream(InputStream stream, AudioFormat format, long length)
stream - the stream on which this AudioInputStream
object is basedformat - the format of this stream's audio datalength - the length in sample frames of the data in this streampublic AudioInputStream(TargetDataLine line)
line - the target data line from which this stream obtains its data.AudioSystem.NOT_SPECIFIED| Method Detail |
|---|
public AudioFormat getFormat()
public long getFrameLength()
public int read()
throws IOException
IOException
will be thrown.
read in class InputStreamIOException - if an input or output error occursread(byte[], int, int),
read(byte[]),
public int read(byte[] b)
throws IOException
b. The number of bytes actually read is
returned as an integer. This method blocks until input data is
available, the end of the stream is detected, or an exception is thrown.
This method will always read an integral number of frames.
If the length of the array is not an integral number
of frames, a maximum of b.length - (b.length % frameSize)
bytes will be read.
read in class InputStreamb - the buffer into which the data is read
IOException - if an input or output error occursread(byte[], int, int),
read(),
available()
public int read(byte[] b,
int off,
int len)
throws IOException
This method will always read an integral number of frames.
If len does not specify an integral number
of frames, a maximum of len - (len % frameSize)
bytes will be read.
read in class InputStreamb - the buffer into which the data is readoff - the offset, from the beginning of array b, at which
the data will be writtenlen - the maximum number of bytes to read
IOException - if an input or output error occursread(byte[]),
read(),
skip(long),
available()
public long skip(long n)
throws IOException
skip in class InputStreamn - the requested number of bytes to be skipped
IOException - if an input or output error occursread(),
available()
public int available()
throws IOException
read or skip method for this audio input stream; the limit
can vary each time these methods are invoked.
Depending on the underlying stream,an IOException may be thrown if this
stream is closed.
available in class InputStreamIOException - if an input or output error occursread(byte[], int, int),
read(byte[]),
read(),
skip(long)
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException - if an input or output error occurspublic void mark(int readlimit)
mark in class InputStreamreadlimit - the maximum number of bytes that can be read before
the mark position becomes invalid.reset(),
markSupported()
public void reset()
throws IOException
mark method was last invoked.
reset in class InputStreamIOException - if an input or output error occurs.mark(int),
markSupported()public boolean markSupported()
mark and
reset methods.
markSupported in class InputStreamCes informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
7 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)