mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-30 21:23:00 +00:00 
			
		
		
		
	Use Java 16 ByteBuffer methods where possible
This commit is contained in:
		| @@ -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() ); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates