パッケージ org.pcap4j.util
クラス ByteArrays
- java.lang.Object
-
- org.pcap4j.util.ByteArrays
-
public final class ByteArrays extends Object
- 導入されたバージョン:
- pcap4j 0.9.1
- 作成者:
- Kaito Yamada
-
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static int
BYTE_SIZE_IN_BITS
static int
BYTE_SIZE_IN_BYTES
static int
INET4_ADDRESS_SIZE_IN_BYTES
static int
INET6_ADDRESS_SIZE_IN_BYTES
static int
INT_SIZE_IN_BYTES
static int
LONG_SIZE_IN_BYTES
static int
SHORT_SIZE_IN_BYTES
-
メソッドの概要
すべてのメソッド staticメソッド concreteメソッド 修飾子とタイプ メソッド 説明 static int
calcAdler32Checksum(byte[] data)
A utility method to calculate Adler-32 checksum.static short
calcChecksum(byte[] data)
A utility method to calculate the Internet checksum.static int
calcCrc32cChecksum(byte[] data)
A utility method to calculate CRC-32C checksum.static int
calcCrc32Checksum(byte[] data)
A utility method to calculate CRC-32 checksum.static byte[]
clone(byte[] array)
static byte[]
concatenate(byte[] arr1, byte[] arr2)
static byte[]
concatenate(List<byte[]> arrs)
static byte
getByte(byte[] array, int offset)
static Inet4Address
getInet4Address(byte[] array, int offset)
static Inet4Address
getInet4Address(byte[] array, int offset, ByteOrder bo)
static Inet6Address
getInet6Address(byte[] array, int offset)
static Inet6Address
getInet6Address(byte[] array, int offset, ByteOrder bo)
static int
getInt(byte[] array, int offset)
static int
getInt(byte[] array, int offset, int length)
static int
getInt(byte[] array, int offset, int length, ByteOrder bo)
static int
getInt(byte[] array, int offset, ByteOrder bo)
static LinkLayerAddress
getLinkLayerAddress(byte[] array, int offset, int length)
static LinkLayerAddress
getLinkLayerAddress(byte[] array, int offset, int length, ByteOrder bo)
static long
getLong(byte[] array, int offset)
static long
getLong(byte[] array, int offset, ByteOrder bo)
static MacAddress
getMacAddress(byte[] array, int offset)
static MacAddress
getMacAddress(byte[] array, int offset, ByteOrder bo)
static short
getShort(byte[] array, int offset)
static short
getShort(byte[] array, int offset, ByteOrder bo)
static byte[]
getSubArray(byte[] array, int offset)
static byte[]
getSubArray(byte[] array, int offset, int length)
static byte[]
parseByteArray(String hexString, String separator)
static byte[]
parseInet4Address(String addr)
static byte[]
reverse(byte[] array)
static byte[]
toByteArray(byte value)
static byte[]
toByteArray(int value)
static byte[]
toByteArray(int value, int length)
static byte[]
toByteArray(int value, int length, ByteOrder bo)
static byte[]
toByteArray(int value, ByteOrder bo)
static byte[]
toByteArray(long value)
static byte[]
toByteArray(long value, ByteOrder bo)
static byte[]
toByteArray(short value)
static byte[]
toByteArray(short value, ByteOrder bo)
static byte[]
toByteArray(InetAddress value)
static byte[]
toByteArray(InetAddress value, ByteOrder bo)
static byte[]
toByteArray(LinkLayerAddress value)
static byte[]
toByteArray(LinkLayerAddress value, ByteOrder bo)
static byte[]
toByteArray(MacAddress value)
static byte[]
toByteArray(MacAddress value, ByteOrder bo)
static String
toHexString(byte[] array, String separator)
static String
toHexString(byte[] array, String separator, int offset, int length)
static String
toHexString(byte value, String separator)
static String
toHexString(int value, String separator)
static String
toHexString(int value, String separator, ByteOrder bo)
static String
toHexString(long value, String separator)
static String
toHexString(long value, String separator, ByteOrder bo)
static String
toHexString(short value, String separator)
static String
toHexString(short value, String separator, ByteOrder bo)
static void
validateBounds(byte[] arr, int offset, int len)
A utility method to validate arguments which indicate a part of an array.static byte[]
xor(byte[] arr1, byte[] arr2)
-
-
-
フィールドの詳細
-
BYTE_SIZE_IN_BYTES
public static final int BYTE_SIZE_IN_BYTES
- 関連項目:
- 定数フィールド値
-
SHORT_SIZE_IN_BYTES
public static final int SHORT_SIZE_IN_BYTES
- 関連項目:
- 定数フィールド値
-
INT_SIZE_IN_BYTES
public static final int INT_SIZE_IN_BYTES
- 関連項目:
- 定数フィールド値
-
LONG_SIZE_IN_BYTES
public static final int LONG_SIZE_IN_BYTES
- 関連項目:
- 定数フィールド値
-
INET4_ADDRESS_SIZE_IN_BYTES
public static final int INET4_ADDRESS_SIZE_IN_BYTES
- 関連項目:
- 定数フィールド値
-
INET6_ADDRESS_SIZE_IN_BYTES
public static final int INET6_ADDRESS_SIZE_IN_BYTES
- 関連項目:
- 定数フィールド値
-
BYTE_SIZE_IN_BITS
public static final int BYTE_SIZE_IN_BITS
- 関連項目:
- 定数フィールド値
-
-
メソッドの詳細
-
reverse
public static byte[] reverse(byte[] array)
- パラメータ:
array
- array- 戻り値:
- a new array containing specified array's elements in reverse order.
-
getByte
public static byte getByte(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- byte value.
-
toByteArray
public static byte[] toByteArray(byte value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toHexString
public static String toHexString(byte value, String separator)
- パラメータ:
value
- valueseparator
- separator- 戻り値:
- hex string
-
getShort
public static short getShort(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- short value
-
getShort
public static short getShort(byte[] array, int offset, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetbo
- bo- 戻り値:
- short value
-
toByteArray
public static byte[] toByteArray(short value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(short value, ByteOrder bo)
- パラメータ:
value
- valuebo
- bo- 戻り値:
- byte array
-
toHexString
public static String toHexString(short value, String separator)
- パラメータ:
value
- valueseparator
- separator- 戻り値:
- hex string
-
toHexString
public static String toHexString(short value, String separator, ByteOrder bo)
- パラメータ:
value
- valueseparator
- separatorbo
- bo- 戻り値:
- hex string
-
getInt
public static int getInt(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- int value.
-
getInt
public static int getInt(byte[] array, int offset, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetbo
- bo- 戻り値:
- int value.
-
getInt
public static int getInt(byte[] array, int offset, int length)
- パラメータ:
array
- arrayoffset
- offsetlength
- length- 戻り値:
- int value.
-
getInt
public static int getInt(byte[] array, int offset, int length, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetlength
- lengthbo
- bo- 戻り値:
- int value.
-
toByteArray
public static byte[] toByteArray(int value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(int value, ByteOrder bo)
- パラメータ:
value
- valuebo
- bo- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(int value, int length)
- パラメータ:
value
- valuelength
- length- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(int value, int length, ByteOrder bo)
- パラメータ:
value
- valuelength
- lengthbo
- bo- 戻り値:
- byte array
-
toHexString
public static String toHexString(int value, String separator)
- パラメータ:
value
- valueseparator
- separator- 戻り値:
- hex string
-
toHexString
public static String toHexString(int value, String separator, ByteOrder bo)
- パラメータ:
value
- valueseparator
- separatorbo
- bo- 戻り値:
- hex string
-
getLong
public static long getLong(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- long value
-
getLong
public static long getLong(byte[] array, int offset, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetbo
- bo- 戻り値:
- long value
-
toByteArray
public static byte[] toByteArray(long value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(long value, ByteOrder bo)
- パラメータ:
value
- valuebo
- bo- 戻り値:
- byte array
-
toHexString
public static String toHexString(long value, String separator)
- パラメータ:
value
- valueseparator
- separator- 戻り値:
- hex string
-
toHexString
public static String toHexString(long value, String separator, ByteOrder bo)
- パラメータ:
value
- valueseparator
- separatorbo
- bo- 戻り値:
- hex string
-
getMacAddress
public static MacAddress getMacAddress(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- a new MacAddress object.
-
getMacAddress
public static MacAddress getMacAddress(byte[] array, int offset, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetbo
- bo- 戻り値:
- a new MacAddress object.
-
toByteArray
public static byte[] toByteArray(MacAddress value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(MacAddress value, ByteOrder bo)
- パラメータ:
value
- valuebo
- bo- 戻り値:
- byte array
-
getLinkLayerAddress
public static LinkLayerAddress getLinkLayerAddress(byte[] array, int offset, int length)
- パラメータ:
array
- arrayoffset
- offsetlength
- length- 戻り値:
- a new LinkLayerAddress object.
-
getLinkLayerAddress
public static LinkLayerAddress getLinkLayerAddress(byte[] array, int offset, int length, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetlength
- lengthbo
- bo- 戻り値:
- a new LinkLayerAddress object.
-
toByteArray
public static byte[] toByteArray(LinkLayerAddress value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(LinkLayerAddress value, ByteOrder bo)
- パラメータ:
value
- valuebo
- bo- 戻り値:
- byte array
-
getInet4Address
public static Inet4Address getInet4Address(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- a new Inet4Address object.
-
getInet4Address
public static Inet4Address getInet4Address(byte[] array, int offset, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetbo
- bo- 戻り値:
- a new Inet4Address object.
-
parseInet4Address
public static byte[] parseInet4Address(String addr)
- パラメータ:
addr
- a string representation of an IPv4 address. (e.g. "192.168.0.100")- 戻り値:
- a byte array representation of the IPv4 address.
- 例外:
IllegalArgumentException
- if failed to parse addr.
-
getInet6Address
public static Inet6Address getInet6Address(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- a new Inet6Address object.
-
getInet6Address
public static Inet6Address getInet6Address(byte[] array, int offset, ByteOrder bo)
- パラメータ:
array
- arrayoffset
- offsetbo
- bo- 戻り値:
- a new Inet6Address object.
-
toByteArray
public static byte[] toByteArray(InetAddress value)
- パラメータ:
value
- value- 戻り値:
- byte array
-
toByteArray
public static byte[] toByteArray(InetAddress value, ByteOrder bo)
- パラメータ:
value
- valuebo
- bo- 戻り値:
- byte array
-
getSubArray
public static byte[] getSubArray(byte[] array, int offset, int length)
- パラメータ:
array
- arrayoffset
- offsetlength
- length- 戻り値:
- sub array
-
getSubArray
public static byte[] getSubArray(byte[] array, int offset)
- パラメータ:
array
- arrayoffset
- offset- 戻り値:
- sub array
-
toHexString
public static String toHexString(byte[] array, String separator)
- パラメータ:
array
- arrayseparator
- separator- 戻り値:
- hex string
-
toHexString
public static String toHexString(byte[] array, String separator, int offset, int length)
- パラメータ:
array
- arrayseparator
- separatoroffset
- offsetlength
- length- 戻り値:
- hex string
-
calcChecksum
public static short calcChecksum(byte[] data)
A utility method to calculate the Internet checksum.- パラメータ:
data
- data- 戻り値:
- checksum
- 関連項目:
- RFC 1071
-
calcCrc32Checksum
public static int calcCrc32Checksum(byte[] data)
A utility method to calculate CRC-32 checksum.- パラメータ:
data
- data- 戻り値:
- checksum
-
calcCrc32cChecksum
public static int calcCrc32cChecksum(byte[] data)
A utility method to calculate CRC-32C checksum.- パラメータ:
data
- data- 戻り値:
- checksum
-
calcAdler32Checksum
public static int calcAdler32Checksum(byte[] data)
A utility method to calculate Adler-32 checksum.- パラメータ:
data
- data- 戻り値:
- checksum
-
parseByteArray
public static byte[] parseByteArray(String hexString, String separator)
- パラメータ:
hexString
- hexStringseparator
- separator- 戻り値:
- a new byte array.
-
clone
public static byte[] clone(byte[] array)
- パラメータ:
array
- array- 戻り値:
- a clone of array
-
validateBounds
public static void validateBounds(byte[] arr, int offset, int len)
A utility method to validate arguments which indicate a part of an array.- パラメータ:
arr
- arroffset
- offsetlen
- len- 例外:
NullPointerException
- if thearr
is null.IllegalArgumentException
- ifarr
is empty orlen
is zero.ArrayIndexOutOfBoundsException
- ifoffset
orlen
is negative, or (offset
+len
) is greater than or equal toarr.length
.
-
xor
public static byte[] xor(byte[] arr1, byte[] arr2)
- パラメータ:
arr1
- arr1arr2
- arr2- 戻り値:
- arr1 xor arr2
-
concatenate
public static byte[] concatenate(byte[] arr1, byte[] arr2)
- パラメータ:
arr1
- arr1arr2
- arr2- 戻り値:
- arr1 + arr2
-
concatenate
public static byte[] concatenate(List<byte[]> arrs)
- パラメータ:
arrs
- arrays- 戻り値:
- the concatenated array.
-
-