/*
* @(#)AudioInputStream.java 1.34 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.sound.sampled;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.io.IOException;
/**
* 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.
* <p>
* The <code>AudioSystem</code> class includes many methods that manipulate
* <code>AudioInputStream</code> objects.
* For example, the methods let you:
* <ul>
* <li> obtain an
* audio input stream from an external audio file, stream, or URL
* <li> write an external file from an audio input stream
* <li> convert an audio input stream to a different audio format
* </ul>
*
* @author David Rivas
* @author Kara Kytle
* @author Florian Bomers
* @version 1.34, 05/11/17
*
* @see AudioSystem
* @see Clip#open(AudioInputStream) Clip.open(AudioInputStream)
* @since 1.3
*/
public class AudioInputStream extends InputStream {
/**
* The <code>InputStream</code> from which this <code>AudioInputStream</code>
* object was constructed.
*/
private InputStream stream;
/**
* The format of the audio data contained in the stream.
*/
protected AudioFormat format;
/**
* This stream's length, in sample frames.
*/
protected long frameLength;
/**
* The size of each frame, in bytes.
*/
protected int frameSize;
/**
* The current position in this stream, in sample frames (zero-based).
*/
protected long framePos;
/**
* The position where a mark was set.
*/
private long markpos;
/**
* When the underlying stream could only return
* a non-integral number of frames, store
* the remainder in a temporary buffer
*/
private byte[] pushBackBuffer = null;
/**
* number of valid bytes in the pushBackBuffer
*/
private int pushBackLen = 0;
/**
* MarkBuffer at mark position
*/
private byte[] markPushBackBuffer = null;
/**
* number of valid bytes in the markPushBackBuffer
*/
private int markPushBackLen = 0;
/**
=1= |