mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-20 10:03:02 -04:00
Created getIntArray method in Packet
This commit is contained in:
@@ -34,6 +34,7 @@ import utilities.Encoder;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -244,6 +245,21 @@ public class Packet {
|
||||
bb.get(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
public static int [] getIntArray(ByteBuffer bb) {
|
||||
IntBuffer ib = bb.asIntBuffer();
|
||||
int size = ib.get();
|
||||
int [] ints = new int[size];
|
||||
ib.get(ints);
|
||||
return ints;
|
||||
}
|
||||
|
||||
public static int [] getIntArray(ByteBuffer bb, int size) {
|
||||
IntBuffer ib = bb.asIntBuffer();
|
||||
int [] ints = new int[size];
|
||||
ib.get(ints);
|
||||
return ints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the ByteBuffer stream into the passed List using the given listType instance for creating elements
|
||||
|
||||
Reference in New Issue
Block a user