keycloak-federation
静的公開メンバ関数 | 静的公開変数類 | 全メンバ一覧
cx.ath.matthew.utils.Hexdump クラス
cx.ath.matthew.utils.Hexdump 連携図
Collaboration graph

静的公開メンバ関数

static String toHex (byte[] buf)
 
static String toHex (byte[] buf, int ofs, int len)
 
static String toAscii (byte[] buf)
 
static String toAscii (byte[] buf, int ofs, int len)
 
static String format (byte[] buf)
 
static String format (byte[] buf, int width)
 
static void print (byte[] buf)
 
static void print (byte[] buf, int width)
 
static void print (byte[] buf, int width, PrintStream out)
 
static void print (byte[] buf, PrintStream out)
 
static String toByteArray (byte[] buf)
 
static String toByteArray (byte[] buf, int ofs, int len)
 

静的公開変数類

static final char [] hexchars = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
 

詳解

関数詳解

◆ format() [1/2]

static String cx.ath.matthew.utils.Hexdump.format ( byte []  buf)
inlinestatic
75  {
76  return format(buf, 80);
77  }
static String format(byte[] buf)
Definition: Hexdump.java:75

◆ format() [2/2]

static String cx.ath.matthew.utils.Hexdump.format ( byte []  buf,
int  width 
)
inlinestatic
79  {
80  int bs = (width - 8) / 4;
81  int i = 0;
82  StringBuffer sb = new StringBuffer();
83  do {
84  for (int j = 0; j < 6; j++) {
85  sb.append(hexchars[(i << (j * 4) & 0xF00000) >> 20]);
86  }
87  sb.append('\t');
88  sb.append(toHex(buf, i, bs));
89  sb.append(' ');
90  sb.append(toAscii(buf, i, bs));
91  sb.append('\n');
92  i += bs;
93  } while (i < buf.length);
94  return sb.toString();
95  }
static String toAscii(byte[] buf)
Definition: Hexdump.java:56
static final char [] hexchars
Definition: Hexdump.java:33
static String toHex(byte[] buf)
Definition: Hexdump.java:35

◆ print() [1/4]

static void cx.ath.matthew.utils.Hexdump.print ( byte []  buf)
inlinestatic
97  {
98  print(buf, System.err);
99  }
static void print(byte[] buf)
Definition: Hexdump.java:97

◆ print() [2/4]

static void cx.ath.matthew.utils.Hexdump.print ( byte []  buf,
int  width 
)
inlinestatic
101  {
102  print(buf, width, System.err);
103  }
static void print(byte[] buf)
Definition: Hexdump.java:97

◆ print() [3/4]

static void cx.ath.matthew.utils.Hexdump.print ( byte []  buf,
int  width,
PrintStream  out 
)
inlinestatic
105  {
106  out.print(format(buf, width));
107  }
static String format(byte[] buf)
Definition: Hexdump.java:75

◆ print() [4/4]

static void cx.ath.matthew.utils.Hexdump.print ( byte []  buf,
PrintStream  out 
)
inlinestatic
109  {
110  out.print(format(buf));
111  }
static String format(byte[] buf)
Definition: Hexdump.java:75

◆ toAscii() [1/2]

static String cx.ath.matthew.utils.Hexdump.toAscii ( byte []  buf)
inlinestatic
56  {
57  return toAscii(buf, 0, buf.length);
58  }
static String toAscii(byte[] buf)
Definition: Hexdump.java:56

◆ toAscii() [2/2]

static String cx.ath.matthew.utils.Hexdump.toAscii ( byte []  buf,
int  ofs,
int  len 
)
inlinestatic
60  {
61  StringBuffer sb = new StringBuffer();
62  int j = ofs + len;
63  for (int i = ofs; i < j; i++) {
64  if (i < buf.length) {
65  if (20 <= buf[i] && 126 >= buf[i])
66  sb.append((char) buf[i]);
67  else
68  sb.append('.');
69  } else
70  sb.append(' ');
71  }
72  return sb.toString();
73  }

◆ toByteArray() [1/2]

static String cx.ath.matthew.utils.Hexdump.toByteArray ( byte []  buf)
inlinestatic

Returns a string which can be written to a Java source file as part of a static initializer for a byte array. Returns data in the format 0xAB, 0xCD, .... use like: javafile.print("byte[] data = {") javafile.print(Hexdump.toByteArray(data)); javafile.println("};");

122  {
123  return toByteArray(buf, 0, buf.length);
124  }
static String toByteArray(byte[] buf)
Definition: Hexdump.java:122

◆ toByteArray() [2/2]

static String cx.ath.matthew.utils.Hexdump.toByteArray ( byte []  buf,
int  ofs,
int  len 
)
inlinestatic

Returns a string which can be written to a Java source file as part of a static initializer for a byte array. Returns data in the format 0xAB, 0xCD, .... use like: javafile.print("byte[] data = {") javafile.print(Hexdump.toByteArray(data)); javafile.println("};");

135  {
136  StringBuffer sb = new StringBuffer();
137  for (int i = ofs; i < len && i < buf.length; i++) {
138  sb.append('0');
139  sb.append('x');
140  sb.append(hexchars[(buf[i] & 0xF0) >> 4]);
141  sb.append(hexchars[buf[i] & 0x0F]);
142  if ((i + 1) < len && (i + 1) < buf.length)
143  sb.append(',');
144  }
145  return sb.toString();
146  }
static final char [] hexchars
Definition: Hexdump.java:33

◆ toHex() [1/2]

static String cx.ath.matthew.utils.Hexdump.toHex ( byte []  buf)
inlinestatic
35  {
36  return toHex(buf, 0, buf.length);
37  }
static String toHex(byte[] buf)
Definition: Hexdump.java:35

◆ toHex() [2/2]

static String cx.ath.matthew.utils.Hexdump.toHex ( byte []  buf,
int  ofs,
int  len 
)
inlinestatic
39  {
40  StringBuffer sb = new StringBuffer();
41  int j = ofs + len;
42  for (int i = ofs; i < j; i++) {
43  if (i < buf.length) {
44  sb.append(hexchars[(buf[i] & 0xF0) >> 4]);
45  sb.append(hexchars[buf[i] & 0x0F]);
46  sb.append(' ');
47  } else {
48  sb.append(' ');
49  sb.append(' ');
50  sb.append(' ');
51  }
52  }
53  return sb.toString();
54  }
static final char [] hexchars
Definition: Hexdump.java:33

メンバ詳解

◆ hexchars

final char [] cx.ath.matthew.utils.Hexdump.hexchars = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
static

このクラス詳解は次のファイルから抽出されました: