Java Code Examples for com.sun.corba.se.impl.orbutil.ORBUtility#isPrintable()
The following examples show how to use
com.sun.corba.se.impl.orbutil.ORBUtility#isPrintable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IDLJavaSerializationInputStream.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 2
Source File: CDRInputStream_1_0.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("----- Input Buffer -----"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); try { char[] charBuf = new char[16]; for (int i = 0; i < bbwi.buflen; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.buflen) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.buflen) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("------------------------"); }
Example 3
Source File: IDLJavaSerializationInputStream.java From hottub with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 4
Source File: CDROutputStream_1_0.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < bbwi.position(); i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.position()) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.position()) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 5
Source File: IDLJavaSerializationOutputStream.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.toByteArray(); System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + buf.length); //System.out.println("Total length : " + buf.length); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 6
Source File: CDROutputStream_1_0.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < bbwi.position(); i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.position()) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.position()) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 7
Source File: IDLJavaSerializationInputStream.java From JDKSourceCode1.8 with MIT License | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 8
Source File: IDLJavaSerializationInputStream.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 9
Source File: CDRInputStream_1_0.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("----- Input Buffer -----"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); try { char[] charBuf = new char[16]; for (int i = 0; i < bbwi.buflen; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.buflen) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.buflen) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("------------------------"); }
Example 10
Source File: CDRInputStream_1_0.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("----- Input Buffer -----"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); try { char[] charBuf = new char[16]; for (int i = 0; i < bbwi.buflen; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.buflen) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.buflen) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("------------------------"); }
Example 11
Source File: CDROutputStream_1_0.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < bbwi.position(); i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.position()) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.position()) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 12
Source File: CDRInputStream_1_0.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("----- Input Buffer -----"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); try { char[] charBuf = new char[16]; for (int i = 0; i < bbwi.buflen; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.buflen) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.buflen) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("------------------------"); }
Example 13
Source File: IDLJavaSerializationOutputStream.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.toByteArray(); System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + buf.length); //System.out.println("Total length : " + buf.length); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 14
Source File: CDRInputStream_1_0.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("----- Input Buffer -----"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); try { char[] charBuf = new char[16]; for (int i = 0; i < bbwi.buflen; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.buflen) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.buflen) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("------------------------"); }
Example 15
Source File: IDLJavaSerializationInputStream.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 16
Source File: CDROutputStream_1_0.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < bbwi.position(); i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.position()) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.position()) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 17
Source File: IDLJavaSerializationOutputStream.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.toByteArray(); System.out.println("+++++++ Output Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + buf.length); //System.out.println("Total length : " + buf.length); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 18
Source File: CDRInputStream_1_0.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
public static void printBuffer(ByteBufferWithInfo bbwi) { System.out.println("----- Input Buffer -----"); System.out.println(); System.out.println("Current position: " + bbwi.position()); System.out.println("Total length : " + bbwi.buflen); System.out.println(); try { char[] charBuf = new char[16]; for (int i = 0; i < bbwi.buflen; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < bbwi.buflen) { int k = bbwi.byteBuffer.get(i + j); if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < bbwi.buflen) { if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) charBuf[x] = (char)bbwi.byteBuffer.get(i + x); else charBuf[x] = '.'; x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("------------------------"); }
Example 19
Source File: IDLJavaSerializationInputStream.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }
Example 20
Source File: IDLJavaSerializationInputStream.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
void printBuffer() { byte[] buf = this.buffer.array(); System.out.println("+++++++ Input Buffer ++++++++"); System.out.println(); System.out.println("Current position: " + getPosition()); System.out.println("Total length : " + this.bufSize); System.out.println(); char[] charBuf = new char[16]; try { for (int i = 0; i < buf.length; i += 16) { int j = 0; // For every 16 bytes, there is one line // of output. First, the hex output of // the 16 bytes with each byte separated // by a space. while (j < 16 && j + i < buf.length) { int k = buf[i + j]; if (k < 0) k = 256 + k; String hex = Integer.toHexString(k); if (hex.length() == 1) hex = "0" + hex; System.out.print(hex + " "); j++; } // Add any extra spaces to align the // text column in case we didn't end // at 16 while (j < 16) { System.out.print(" "); j++; } // Now output the ASCII equivalents. Non-ASCII // characters are shown as periods. int x = 0; while (x < 16 && x + i < buf.length) { if (ORBUtility.isPrintable((char)buf[i + x])) { charBuf[x] = (char) buf[i + x]; } else { charBuf[x] = '.'; } x++; } System.out.println(new String(charBuf, 0, x)); } } catch (Throwable t) { t.printStackTrace(); } System.out.println("++++++++++++++++++++++++++++++"); }