Java Doc for AudioInputStream.java in  » 6.0-JDK-Core » sound » javax » sound » sampled » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sound » javax.sound.sampled 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      javax.sound.sampled.AudioInputStream

AudioInputStream
public class AudioInputStream extends InputStream (Code)
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:

  • obtain an audio input stream from an external audio file, stream, or URL
  • write an external file from an audio input stream
  • convert an audio input stream to a different audio format

author:
   David Rivas
author:
   Kara Kytle
author:
   Florian Bomers
version:
   1.40, 07/05/05
See Also:   AudioSystem
See Also:   Clip.open(AudioInputStream)
See Also:    Clip.open(AudioInputStream)
since:
   1.3


Field Summary
protected  AudioFormatformat
     The format of the audio data contained in the stream.
protected  longframeLength
     This stream's length, in sample frames.
protected  longframePos
     The current position in this stream, in sample frames (zero-based).
protected  intframeSize
     The size of each frame, in bytes.

Constructor Summary
public  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.
public  AudioInputStream(TargetDataLine line)
     Constructs an audio input stream that reads its data from the target data line indicated.

Method Summary
public  intavailable()
     Returns the maximum number of bytes that can be read (or skipped over) from this audio input stream without blocking.
public  voidclose()
     Closes this audio input stream and releases any system resources associated with the stream.
public  AudioFormatgetFormat()
     Obtains the audio format of the sound data in this audio input stream.
public  longgetFrameLength()
     Obtains the length of the stream, expressed in sample frames rather than bytes.
public  voidmark(int readlimit)
     Marks the current position in this audio input stream.
public  booleanmarkSupported()
     Tests whether this audio input stream supports the mark and reset methods.
public  intread()
     Reads the next byte of data from the audio input stream.
public  intread(byte[] b)
     Reads some number of bytes from the audio input stream and stores them into the buffer array b.
public  intread(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.
public  voidreset()
     Repositions this audio input stream to the position it had at the time its mark method was last invoked.
public  longskip(long n)
     Skips over and discards a specified number of bytes from this audio input stream.

Field Detail
format
protected AudioFormat format(Code)
The format of the audio data contained in the stream.



frameLength
protected long frameLength(Code)
This stream's length, in sample frames.



framePos
protected long framePos(Code)
The current position in this stream, in sample frames (zero-based).



frameSize
protected int frameSize(Code)
The size of each frame, in bytes.




Constructor Detail
AudioInputStream
public AudioInputStream(InputStream stream, AudioFormat format, long length)(Code)
Constructs an audio input stream that has the requested format and length in sample frames, using audio data from the specified input stream.
Parameters:
  stream - the stream on which this AudioInputStreamobject is based
Parameters:
  format - the format of this stream's audio data
Parameters:
  length - the length in sample frames of the data in this stream



AudioInputStream
public AudioInputStream(TargetDataLine line)(Code)
Constructs an audio input stream that reads its data from the target data line indicated. The format of the stream is the same as that of the target data line, and the length is AudioSystem#NOT_SPECIFIED.
Parameters:
  line - the target data line from which this stream obtains its data.
See Also:   AudioSystem.NOT_SPECIFIED




Method Detail
available
public int available() throws IOException(Code)
Returns the maximum number of bytes that can be read (or skipped over) from this audio input stream without blocking. This limit applies only to the next invocation of a 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. the number of bytes that can be read from this audio input stream without blocking
throws:
  IOException - if an input or output error occurs
See Also:   AudioInputStream.read(byte[],int,int)
See Also:   AudioInputStream.read(byte[])
See Also:   AudioInputStream.read()
See Also:   AudioInputStream.skip



close
public void close() throws IOException(Code)
Closes this audio input stream and releases any system resources associated with the stream.
throws:
  IOException - if an input or output error occurs



getFormat
public AudioFormat getFormat()(Code)
Obtains the audio format of the sound data in this audio input stream. an audio format object describing this stream's format



getFrameLength
public long getFrameLength()(Code)
Obtains the length of the stream, expressed in sample frames rather than bytes. the length in sample frames



mark
public void mark(int readlimit)(Code)
Marks the current position in this audio input stream.
Parameters:
  readlimit - the maximum number of bytes that can be read beforethe mark position becomes invalid.
See Also:   AudioInputStream.reset
See Also:   AudioInputStream.markSupported



markSupported
public boolean markSupported()(Code)
Tests whether this audio input stream supports the mark and reset methods. true if this stream supports the markand reset methods; false otherwise
See Also:   AudioInputStream.mark
See Also:   AudioInputStream.reset



read
public int read() throws IOException(Code)
Reads the next byte of data from the audio input stream. The audio input stream's frame size must be one byte, or an IOException will be thrown. the next byte of data, or -1 if the end of the stream is reached
throws:
  IOException - if an input or output error occurs
See Also:   AudioInputStream.read(byte[],int,int)
See Also:   AudioInputStream.read(byte[])
See Also:   AudioInputStream.available
See Also:   




read
public int read(byte[] b) throws IOException(Code)
Reads some number of bytes from the audio input stream and stores them into the buffer array 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.
Parameters:
  b - the buffer into which the data is read the total number of bytes read into the buffer, or -1 if thereis no more data because the end of the stream has been reached
throws:
  IOException - if an input or output error occurs
See Also:   AudioInputStream.read(byte[],int,int)
See Also:   AudioInputStream.read()
See Also:   AudioInputStream.available




read
public int read(byte[] b, int off, int len) throws IOException(Code)
Reads up to a specified maximum number of bytes of data from the audio stream, putting them into the given byte array.

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.
Parameters:
  b - the buffer into which the data is read
Parameters:
  off - the offset, from the beginning of array b, at whichthe data will be written
Parameters:
  len - the maximum number of bytes to read the total number of bytes read into the buffer, or -1 if thereis no more data because the end of the stream has been reached
throws:
  IOException - if an input or output error occurs
See Also:   AudioInputStream.read(byte[])
See Also:   AudioInputStream.read()
See Also:   AudioInputStream.skip
See Also:   AudioInputStream.available




reset
public void reset() throws IOException(Code)
Repositions this audio input stream to the position it had at the time its mark method was last invoked.
throws:
  IOException - if an input or output error occurs.
See Also:   AudioInputStream.mark
See Also:   AudioInputStream.markSupported



skip
public long skip(long n) throws IOException(Code)
Skips over and discards a specified number of bytes from this audio input stream.
Parameters:
  n - the requested number of bytes to be skipped the actual number of bytes skipped
throws:
  IOException - if an input or output error occurs
See Also:   AudioInputStream.read
See Also:   AudioInputStream.available



Methods inherited from java.io.InputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
abstract public int read() throws IOException(Code)(Java Doc)
public int read(byte b) throws IOException(Code)(Java Doc)
public int read(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized void reset() throws IOException(Code)(Java Doc)
public long skip(long n) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.