/** * The number of doubles that can currently be read from this double data source without blocking. This number can change over * time. * * @return the number of doubles that can currently be read without blocking */ public int available() { try { int bytes = ais.available(); return bytes / bytesPerSample; } catch (IOException e) { return 0; } }
/** * The number of doubles that can currently be read from this double data source without blocking. This number can change over * time. * * @return the number of doubles that can currently be read without blocking */ public int available() { try { int bytes = ais.available(); return bytes / bytesPerSample; } catch (IOException e) { return 0; } }
/** * 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 <code>read</code> or <code>skip</code> 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. * * @return 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 #read(byte[], int, int) * @see #read(byte[]) * @see #read() * @see #skip */ public int available() throws IOException { int av = super.available(); if (av <= 0) return av; return 2 * av / inputChannels; }
/** * 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 <code>read</code> or <code>skip</code> 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. * * @return 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 #read(byte[], int, int) * @see #read(byte[]) * @see #read() * @see #skip */ public int available() throws IOException { int av = super.available(); if (av <= 0) return av; return av / inputChannels; }
/** * 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 <code>read</code> or <code>skip</code> 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. * * @return 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 #read(byte[], int, int) * @see #read(byte[]) * @see #read() * @see #skip */ public int available() throws IOException { int av = super.available(); if (av <= 0) return av; return av / inputChannels; }
/** * 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 <code>read</code> or <code>skip</code> 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. * * @return 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 #read(byte[], int, int) * @see #read(byte[]) * @see #read() * @see #skip */ public int available() throws IOException { int av = super.available(); if (av <= 0) return av; return 2 * av / inputChannels; }
public int available() throws IOException { return getCurrentStream().available(); }
public int available() throws IOException { return getCurrentStream().available(); }
public int available() throws IOException { return getCurrentStream().available(); }
public int available() throws IOException { return getCurrentStream().available(); }
if (file.exists()) { ais = AudioSystem.getAudioInputStream(file); int bytesToRead = ais.available(); data = new byte[bytesToRead]; int bytesRead = ais.read(data); URL url = StdAudio.class.getResource(filename); ais = AudioSystem.getAudioInputStream(url); int bytesToRead = ais.available(); data = new byte[bytesToRead]; int bytesRead = ais.read(data);
/** * Turns the AudioInputStream into a 16bit, SIGNED_PCM, little endian audio stream that preserves the original sample * rate of the AudioInputStream. NOTE: this assumes the frame size can be only 1 or 2 bytes. The AudioInputStream * is left in a state of having all of its data being read. * @param ais stream to convert * @return result array * @throws IOException if error occurred */ static public short[] toSignedPCM(AudioInputStream ais) throws IOException { AudioFormat aisFormat = ais.getFormat(); short[] shorts = new short[ais.available() / aisFormat.getFrameSize()]; byte[] frame = new byte[aisFormat.getFrameSize()]; int pos = 0; while (ais.read(frame) != -1) { shorts[pos++] = bytesToShort(aisFormat, frame); } return shorts; }
int nBytes = ais.available(); boolean bigEndian = ais.getFormat().isBigEndian(); byte[] byteBuf = new byte[nBytes];
int nBytes = ais.available(); boolean bigEndian = ais.getFormat().isBigEndian(); byte[] byteBuf = new byte[nBytes];
int nBytes = ais.available(); boolean bigEndian = ais.getFormat().isBigEndian(); byte[] byteBuf = new byte[nBytes];
int nBytes = ais.available(); boolean bigEndian = ais.getFormat().isBigEndian(); byte[] byteBuf = new byte[nBytes];
int nBytes = ais.available();
int nBytes = ais.available();
float samplingRate = ais.getFormat().getSampleRate(); int channels = ais.getFormat().getChannels(); int nBytes = ais.available(); boolean bigEndian = ais.getFormat().isBigEndian(); byte[] byteBuf = new byte[nBytes];
float samplingRate = ais.getFormat().getSampleRate(); int channels = ais.getFormat().getChannels(); int nBytes = ais.available(); boolean bigEndian = ais.getFormat().isBigEndian(); byte[] byteBuf = new byte[nBytes];