|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.packet.format.FormatUtils
public class FormatUtils
Various static formatting utilities
| Constructor Summary | |
|---|---|
FormatUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
asString(byte[] array)
Converts the given byte array to a string using a default separator character |
static java.lang.String |
asString(byte[] array,
char separator)
Convers the given byte array to a string using the supplied separator character |
static java.lang.String |
asString(byte[] array,
char separator,
int radix)
Converts the given byte array to a string using the supplied separator character and radix for conversion of the numerical component |
static java.lang.String |
asString(byte[] array,
char separator,
int radix,
int start,
int len)
Convers the given byte array to a string using the supplied separator character |
static java.lang.String |
asStringIp6(byte[] array,
boolean holes)
Handles various forms of ip6 addressing |
static java.lang.String |
formatTimeInMillis(long millis)
Formats a delta time |
static java.lang.String |
hexdump(byte[] array)
Formats the supplied array for single line combined hexdump output using all possible options turned on. |
static java.lang.String[] |
hexdump(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData)
Formats a byte array to a hexdump string |
static java.lang.String[] |
hexdump(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData,
int[][] markers)
Formats a byte array to a hexdump string |
static java.lang.String |
hexdump(byte[] array,
JPacket.State state)
Formats the supplied array for single line combined hexdump output using all possible options turned on. |
static java.lang.String |
hexdump(JPacket packet)
Formats the supplied packet for single line combined hexdump output using all possible options turned on. |
static java.lang.String |
hexdumpCombined(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData)
Converts the byte arra to hexdump string |
static java.lang.String |
hexdumpCombined(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData,
int[][] markers)
Converts the byte arra to hexdump string |
static java.lang.String |
hexLine(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData,
int[][] markers)
Converts the byte arra to hexdump string |
static java.lang.String |
hexLineAddress(int address)
Format an address |
static java.lang.String |
hexLineData(byte[] data,
int offset)
Formats the data array as a hexdump |
static java.lang.String |
hexLineData(byte[] data,
int offset,
int[][] markers)
Formats the data array as a hexdump |
static java.lang.String |
hexLineText(byte[] data,
int offset)
Formats the array data to human readable text that appears at the end of a hexline of a hexdump |
static java.lang.String |
ip(byte[] address)
|
static java.lang.String |
mac(byte[] address)
|
static int[][] |
markers(JPacket.State state)
|
static byte[] |
toByteArray(java.lang.String source)
Parses a string containing hex numbers to a byte array |
static java.lang.String |
toHexString(byte b)
Formats a number to hext |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FormatUtils()
| Method Detail |
|---|
public static java.lang.String asString(byte[] array)
array - array to convert
public static java.lang.String asString(byte[] array,
char separator)
array - array to convertseparator - separator character to use in between array elements
public static java.lang.String asString(byte[] array,
char separator,
int radix)
array - array to convertseparator - separator character to use in between array elementsradix - numerical radix to use for numbers
public static java.lang.String asString(byte[] array,
char separator,
int radix,
int start,
int len)
array - array to convertseparator - separator character to use in between array elements
public static java.lang.String ip(byte[] address)
public static java.lang.String mac(byte[] address)
public static java.lang.String asStringIp6(byte[] array,
boolean holes)
2001:0db8:0000:0000:0000:0000:1428:57ab
2001:0db8:0000:0000:0000::1428:57ab
2001:0db8:0:0:0:0:1428:57ab
2001:0db8:0:0::1428:57ab
2001:0db8::1428:57ab
2001:db8::1428:57ab
array - address arrayholes - if true holes are allowed
public static java.lang.String formatTimeInMillis(long millis)
millis - delta timestamp in millis
public static java.lang.String[] hexdump(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData)
array - array to convertaddressOffset - offset of the address space reporteddataOffset - offset of the data space reporteddoAddress - flag which specifies if address should be printeddoText - flag which specifies if text should printeddoData - flag which specifies if data should printed
public static int[][] markers(JPacket.State state)
public static java.lang.String[] hexdump(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData,
int[][] markers)
array - array to convertaddressOffset - offset of the address space reporteddataOffset - offset of the data space reporteddoAddress - flag which specifies if address should be printeddoText - flag which specifies if text should printeddoData - flag which specifies if data should printed
public static java.lang.String hexdump(byte[] array)
array - source array
public static java.lang.String hexdump(JPacket packet)
packet - source of data
public static java.lang.String hexdump(byte[] array,
JPacket.State state)
array - source array
public static java.lang.String hexdumpCombined(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData)
array - array to convertaddressOffset - offset of the address space reporteddataOffset - offset of the data space reporteddoAddress - flag which specifies if address should be printeddoText - flag which specifies if text should printeddoData - flag which specifies if data should printed
public static java.lang.String hexdumpCombined(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData,
int[][] markers)
array - array to convertaddressOffset - offset of the address space reporteddataOffset - offset of the data space reporteddoAddress - flag which specifies if address should be printeddoText - flag which specifies if text should printeddoData - flag which specifies if data should printed
public static java.lang.String hexLine(byte[] array,
int addressOffset,
int dataOffset,
boolean doAddress,
boolean doText,
boolean doData,
int[][] markers)
array - array to convertaddressOffset - offset of the address space reporteddataOffset - offset of the data space reporteddoAddress - flag which specifies if address should be printeddoText - flag which specifies if text should printeddoData - flag which specifies if data should printed
public static java.lang.String hexLineAddress(int address)
address - integer address
public static java.lang.String hexLineData(byte[] data,
int offset)
data - data arrayoffset - offset into the array
public static java.lang.String hexLineData(byte[] data,
int offset,
int[][] markers)
data - data arrayoffset - offset into the array
public static java.lang.String hexLineText(byte[] data,
int offset)
data - data arrayoffset - offset into data array
public static byte[] toByteArray(java.lang.String source)
source - source string
public static java.lang.String toHexString(byte b)
b - input byte
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||