Java Code Examples for java.nio.ShortBuffer#reset()
The following examples show how to use
java.nio.ShortBuffer#reset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PcmChunkEncoder.java From lavaplayer with Apache License 2.0 | 6 votes |
@Override public byte[] encode(ShortBuffer buffer) { buffer.mark(); encodedAsShort.clear(); encodedAsShort.put(buffer); encoded.clear(); encoded.limit(encodedAsShort.position() * 2); byte[] encodedBytes = new byte[encoded.remaining()]; encoded.get(encodedBytes); buffer.reset(); return encodedBytes; }
Example 2
Source File: PcmChunkEncoder.java From lavaplayer with Apache License 2.0 | 5 votes |
@Override public void encode(ShortBuffer buffer, ByteBuffer out) { buffer.mark(); encodedAsShort.clear(); encodedAsShort.put(buffer); out.put(encoded.array(), 0, encodedAsShort.position() * 2); out.flip(); buffer.reset(); }