minecraft-src/net/minecraft/client/sounds/AudioStream.java
2025-07-04 01:41:11 +03:00

26 lines
978 B
Java

package net.minecraft.client.sounds;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import javax.sound.sampled.AudioFormat;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public interface AudioStream extends Closeable {
/**
* {@return the {@linkplain AudioFormat} of the stream}
*/
AudioFormat getFormat();
/**
* Reads audio data from the stream and returns a byte buffer containing at most the specified number of bytes.
* The method reads audio frames from the stream and adds them to the output buffer until the buffer contains at least the specified number of bytes or the end fo the stream is reached.
* @return a byte buffer containing at most the specified number of bytes to read
* @throws IOException if an I/O error occurs while reading the audio data
*
* @param size the maximum number of bytes to read
*/
ByteBuffer read(int size) throws IOException;
}