mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-15 04:30:29 +00:00
Use Java 16 ByteBuffer methods where possible
This commit is contained in:
parent
05da4dd362
commit
2f6ad00764
@ -106,7 +106,8 @@ class DfpwmStream implements AudioStream
|
||||
if( head == null ) break;
|
||||
|
||||
int toRead = Math.min( head.remaining(), result.remaining() );
|
||||
result.put( head.array(), head.position(), toRead ); // TODO: In 1.17 convert this to a ByteBuffer override
|
||||
result.put( result.position(), head, head.position(), toRead );
|
||||
result.position( result.position() + toRead );
|
||||
head.position( head.position() + toRead );
|
||||
|
||||
if( head.hasRemaining() ) break;
|
||||
|
@ -53,10 +53,6 @@ public class FileSlice
|
||||
return;
|
||||
}
|
||||
|
||||
ByteBuffer other = file.duplicate();
|
||||
other.position( offset ); // TODO: In 1.17 we can use a separate put(idx, _) method.
|
||||
other.put( bytes );
|
||||
|
||||
if( bytes.remaining() != 0 ) throw new IllegalStateException( "Should have read the whole buffer" );
|
||||
file.put( offset, bytes, bytes.position(), bytes.remaining() );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user