public class EtUtils
extends java.lang.Object
Constructor and Description |
---|
EtUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
bytesToInt(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into an int.
|
static int |
bytesToInt(byte[] b,
int off)
Converts 4 bytes of a byte array into an integer.
|
static long |
bytesToLong(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into a long.
|
static long |
bytesToLong(byte[] b,
int off)
Converts 8 bytes of a byte array into a long.
|
static short |
bytesToShort(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into a short.
|
static short |
bytesToShort(byte[] b,
int off)
Converts 2 bytes of a byte array into a short.
|
static java.util.List<java.lang.String> |
getAllBroadcastAddresses()
Get all local IP broadcast addresses in a list in dotted-decimal form.
|
static void |
intToBytes(int intVal,
byte[] b,
int off)
Copies an integer value into 4 bytes of a byte array.
|
static void |
intToBytes(int data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn int into byte array.
|
static void |
longToBytes(long longVal,
byte[] b,
int off)
Copies an long (64 bit) value into 8 bytes of a byte array.
|
static void |
longToBytes(long data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn long into byte array.
|
static java.util.List<java.lang.String> |
orderIPAddresses(java.util.List<java.lang.String> ipAddresses)
Takes a list of dotted-decimal formatted IP address strings and orders them
so that those on local subnets are first and others come last.
|
static void |
shortToBytes(short shortVal,
byte[] b,
int off)
Copies a short value into 2 bytes of a byte array.
|
static void |
shortToBytes(short data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn short into byte array.
|
static void |
swapArrayInt(byte[] b,
int off)
Swaps 4 bytes of a byte array in place.
|
static void |
swapArrayShort(byte[] b,
int off)
Swaps 2 bytes of a byte array in place.
|
public static void shortToBytes(short data, java.nio.ByteOrder byteOrder, byte[] dest, int off)
data
- short to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedpublic static void intToBytes(int data, java.nio.ByteOrder byteOrder, byte[] dest, int off)
data
- int to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedpublic static void longToBytes(long data, java.nio.ByteOrder byteOrder, byte[] dest, int off)
data
- long to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedpublic static void shortToBytes(short shortVal, byte[] b, int off)
shortVal
- short valueb
- byte arrayoff
- offset into the byte arraypublic static void intToBytes(int intVal, byte[] b, int off)
intVal
- integer valueb
- byte arrayoff
- offset into the byte arraypublic static void longToBytes(long longVal, byte[] b, int off)
longVal
- long valueb
- byte arrayoff
- offset into the byte arraypublic static short bytesToShort(byte[] data, java.nio.ByteOrder byteOrder, int off)
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arraypublic static int bytesToInt(byte[] data, java.nio.ByteOrder byteOrder, int off)
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arraypublic static long bytesToLong(byte[] data, java.nio.ByteOrder byteOrder, int off)
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arraypublic static short bytesToShort(byte[] b, int off)
b
- byte arrayoff
- offset into the byte array (0 = start at first element)public static int bytesToInt(byte[] b, int off)
b
- byte arrayoff
- offset into the byte array (0 = start at first element)public static long bytesToLong(byte[] b, int off)
b
- byte arrayoff
- offset into the byte array (0 = start at first element)public static void swapArrayInt(byte[] b, int off)
b
- byte arrayoff
- offset into the byte arraypublic static void swapArrayShort(byte[] b, int off)
b
- byte arrayoff
- offset into the byte arraypublic static java.util.List<java.lang.String> getAllBroadcastAddresses()
public static java.util.List<java.lang.String> orderIPAddresses(java.util.List<java.lang.String> ipAddresses)