Simpler custom byte array reading.
This commit is contained in:
		
							parent
							
								
									e68f496302
								
							
						
					
					
						commit
						8e347f0761
					
				
							
								
								
									
										2
									
								
								pom.xml
								
								
								
								
							
							
						
						
									
										2
									
								
								pom.xml
								
								
								
								
							| 
						 | 
				
			
			@ -6,7 +6,7 @@
 | 
			
		|||
 | 
			
		||||
    <groupId>nl.andrewl</groupId>
 | 
			
		||||
    <artifactId>record-net</artifactId>
 | 
			
		||||
    <version>1.3.1</version>
 | 
			
		||||
    <version>1.3.2</version>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
        <maven.compiler.source>17</maven.compiler.source>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,12 @@ public class ExtendedDataInputStream extends DataInputStream {
 | 
			
		|||
	public byte[] readByteArray() throws IOException {
 | 
			
		||||
		int length = readInt();
 | 
			
		||||
		if (length < 0) return null;
 | 
			
		||||
		return readNBytes(length);
 | 
			
		||||
		byte[] array = new byte[length];
 | 
			
		||||
		int readCount = read(array, 0, length);
 | 
			
		||||
		while (readCount < length) {
 | 
			
		||||
			readCount += read(array, readCount, length - readCount);
 | 
			
		||||
		}
 | 
			
		||||
		return array;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int[] readIntArray() throws IOException {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue