< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java

Print this page

        

*** 20,29 **** --- 20,30 ---- * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ + package com.sun.media.sound; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException;
*** 64,81 **** --- 65,85 ---- framesize_pc = format.getFrameSize() / format.getChannels(); this.buffer_len = len / framesize_pc; } + @Override public AudioFormat getFormat() { return format; } + @Override public long getFrameLength() { return buffer_len;// / format.getFrameSize(); } + @Override public int read(float[] b, int off, int len) throws IOException { if (b == null) throw new NullPointerException(); if (off < 0 || len < 0 || len > b.length - off) throw new IndexOutOfBoundsException();
*** 89,98 **** --- 93,103 ---- b, off, len); pos += len; return len; } + @Override public long skip(long len) throws IOException { if (pos >= buffer_len) return -1; if (len <= 0) return 0;
*** 100,124 **** --- 105,134 ---- len = buffer_len - pos; pos += len; return len; } + @Override public int available() throws IOException { return buffer_len - pos; } + @Override public void close() throws IOException { } + @Override public void mark(int readlimit) { markpos = pos; } + @Override public boolean markSupported() { return true; } + @Override public void reset() throws IOException { pos = markpos; } }
*** 161,178 **** --- 171,191 ---- framesize_pc = stream.getFormat().getFrameSize() / stream.getFormat().getChannels(); this.stream = stream; } + @Override public AudioFormat getFormat() { return stream.getFormat(); } + @Override public long getFrameLength() { return stream.getFrameLength(); } + @Override public int read(float[] b, int off, int len) throws IOException { int b_len = len * framesize_pc; if (buffer == null || buffer.length < b_len) buffer = new byte[b_len]; int ret = stream.read(buffer, 0, b_len);
*** 180,213 **** --- 193,232 ---- return -1; converter.toFloatArray(buffer, b, off, ret / framesize_pc); return ret / framesize_pc; } + @Override public long skip(long len) throws IOException { long b_len = len * framesize_pc; long ret = stream.skip(b_len); if (ret == -1) return -1; return ret / framesize_pc; } + @Override public int available() throws IOException { return stream.available() / framesize_pc; } + @Override public void close() throws IOException { stream.close(); } + @Override public void mark(int readlimit) { stream.mark(readlimit * framesize_pc); } + @Override public boolean markSupported() { return stream.markSupported(); } + @Override public void reset() throws IOException { stream.reset(); } }
< prev index next >