You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2013/04/25 13:47:35 UTC
[4/4] git commit: removed reference to IoBuffer
removed reference to IoBuffer
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/94da8200
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/94da8200
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/94da8200
Branch: refs/heads/trunk
Commit: 94da8200b3ef16fff3a06d80c9ac299fb65d1e03
Parents: 8096739
Author: jvermillard <jv...@apache.org>
Authored: Thu Apr 25 13:46:27 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Thu Apr 25 13:46:27 2013 +0200
----------------------------------------------------------------------
.../org/apache/mina/util/ByteBufferDumper.java | 41 ++------------
1 files changed, 6 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/94da8200/core/src/main/java/org/apache/mina/util/ByteBufferDumper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/util/ByteBufferDumper.java b/core/src/main/java/org/apache/mina/util/ByteBufferDumper.java
index 47127ad..0d6981b 100644
--- a/core/src/main/java/org/apache/mina/util/ByteBufferDumper.java
+++ b/core/src/main/java/org/apache/mina/util/ByteBufferDumper.java
@@ -22,45 +22,17 @@ import java.nio.ByteBuffer;
/**
* Utility class for smart dumping {@link ByteBuffer}
- *
+ *
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
public class ByteBufferDumper {
/** Hex chars */
private static final byte[] HEX_CHAR = new byte[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
- 'C', 'D', 'E', 'F' };
-
- /**
- * Dump the content of a IoBuffer
- *
- * @param buffer The IoBuffer to dump
- * @return A string representing the IoBuffer content
- */
- public static String dump(IoBuffer buffer) {
- StringBuilder sb = new StringBuilder();
-
- boolean isFirst = true;
-
- for (int i = 0; i < buffer.limit(); i++) {
- byte byteValue = buffer.get(i);
-
- if (isFirst) {
- isFirst = false;
- } else {
- sb.append(' ');
- }
-
- sb.append(new String(new byte[] { '0', 'x', HEX_CHAR[(byteValue & 0x00F0) >> 4],
- HEX_CHAR[byteValue & 0x000F] }));
- }
-
- return sb.toString();
- }
+ 'C', 'D', 'E', 'F' };
/**
- * Dump the content of the given ByteBuffer, up to a number of bytes. If the
- * toAscii flag is set to <code>true</code>, this method will try to convert
- * the bytes to a String
+ * Dump the content of the given ByteBuffer, up to a number of bytes. If the toAscii flag is set to
+ * <code>true</code>, this method will try to convert the bytes to a String
*
* @param buffer The buffer to dump
* @param nbBytes The number of bytes to dump (-1 for all of them)
@@ -105,7 +77,7 @@ public class ByteBufferDumper {
byteValue = data[i] & 0xFF;
out.append(new String(new byte[] { '0', 'x', HEX_CHAR[(byteValue & 0x00F0) >> 4],
- HEX_CHAR[byteValue & 0x000F] }));
+ HEX_CHAR[byteValue & 0x000F] }));
}
out.append("']");
@@ -122,8 +94,7 @@ public class ByteBufferDumper {
}
/**
- * Dumps the given buffer. If the buffer contains only ascii, it will write
- * the buffer content as a String.
+ * Dumps the given buffer. If the buffer contains only ascii, it will write the buffer content as a String.
*
* @param buffer The buffer to dump
* @return A string representing the buffer content