Class ByteTransfer
java.lang.Object
net.avadeaux.klipspringer.codec.ByteTransfer
Utility methods for facilitating reading and writing when the reader/writer requires one
specific buffer type and the data is requested/provided in another.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for reading data to byte array.static interfaceInterface for writing data from byte array. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanread(ByteBuffer dest, ByteTransfer.ArrayReader in, int fs) Reads into destination buffer, if necessary via an intermediary nondirect byte buffer.static booleanreadDirect(ByteBuffer dest, PcmReader in, int fs) Reads into the destination PCM byte buffer via an intermediary direct byte buffer.static booleanwrite(ByteBuffer data, ByteTransfer.ArrayWriter out, int fs) Writes data from a buffer, if necessary via an intermediary nondirect byte buffer.static booleanwriteDirect(ByteBuffer data, PcmWriter out, int fs) Writes PCM data from a byte buffer via an intermediary direct byte buffer.
-
Method Details
-
readDirect
Reads into the destination PCM byte buffer via an intermediary direct byte buffer. Has the effect thatin.read(dest)would if the buffer was direct.- Throws:
IOException
-
writeDirect
Writes PCM data from a byte buffer via an intermediary direct byte buffer. Has the effect thatout.write(data)would if the buffer was direct.- Throws:
IOException
-
read
Reads into destination buffer, if necessary via an intermediary nondirect byte buffer. Has the effect thatin.read(dest.array(), dest.position(), dest.remaining()would if the buffer had an accessible backing array.- Throws:
IOException
-
write
public static boolean write(ByteBuffer data, ByteTransfer.ArrayWriter out, int fs) throws IOException Writes data from a buffer, if necessary via an intermediary nondirect byte buffer. Has the effect thatout.write(data.array(), data.position(), data.remaining()would if the buffer had an accessible backing array.- Throws:
IOException
-