FileDocCategorySizeDatePackage
DumpUtils.javaAPI DocExample6445Tue May 29 16:57:14 BST 2007com.sun.xml.ws.transport.tcp.util

DumpUtils

public final class DumpUtils extends Object
author
Alexey Stashok

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.Stringdump(byte[] buffer)

        return dump(buffer, 0, buffer.length);
    
public static java.lang.Stringdump(byte[] buffer, int offset, int length)

        final StringBuffer stringBuffer = new StringBuffer();
        for(int i=0; i<length; i++) {
            final int value = buffer[offset + i] & 0xFF;
            final String strValue = Integer.toHexString(value).toUpperCase();
            final String str = "00".substring(strValue.length()) + strValue;
            stringBuffer.append(str);
            stringBuffer.append('(");
            stringBuffer.append((char) value);
            stringBuffer.append(')");
            stringBuffer.append(' ");
        }
        
        return stringBuffer.toString();
    
public static java.lang.Stringdump(java.nio.ByteBuffer[] bb)

        final StringBuffer stringBuffer = new StringBuffer();
        for(int i=0; i<bb.length; i++) {
            stringBuffer.append(dump(bb[i]));
        }
        
        return stringBuffer.toString();
    
public static java.lang.Stringdump(java.nio.ByteBuffer buffer)

        return dump(buffer, buffer.position(), buffer.limit() - buffer.position());
    
public static java.lang.Stringdump(java.nio.ByteBuffer buffer, int offset, int length)

        final byte[] array = new byte[length];
        final int position = buffer.position();
        buffer.position(offset);
        buffer.get(array);
        buffer.position(position);
        return dump(array);
    
public static java.lang.StringdumpBytes(java.nio.ByteBuffer[] bb)

        final StringBuffer stringBuffer = new StringBuffer();
        for(int i=0; i<bb.length; i++) {
            stringBuffer.append(dumpBytes(bb[i]));
        }
        
        return stringBuffer.toString();
    
public static java.lang.StringdumpBytes(byte[] buffer)

        return dumpBytes(buffer, 0, buffer.length);
    
public static java.lang.StringdumpBytes(byte[] buffer, int offset, int length)

        final StringBuffer stringBuffer = new StringBuffer();
        for(int i=0; i<length; i++) {
            final int value = buffer[offset + i] & 0xFF;
            stringBuffer.append((char) value);
        }
        
        return stringBuffer.toString();
    
public static java.lang.StringdumpBytes(java.nio.ByteBuffer buffer)

        return dumpBytes(buffer, buffer.position(), buffer.limit() - buffer.position());
    
public static java.lang.StringdumpBytes(java.nio.ByteBuffer buffer, int offset, int length)

        final byte[] array = new byte[length];
        final int position = buffer.position();
        buffer.position(offset);
        buffer.get(array);
        buffer.position(position);
        return dumpBytes(array);
    
public static java.lang.StringdumpOctets(byte[] buffer)

        return dumpOctets(buffer, 0, buffer.length);
    
public static java.lang.StringdumpOctets(byte[] buffer, int offset, int length)

        final StringBuffer stringBuffer = new StringBuffer();
        for(int i=0; i<length; i++) {
            final int value = buffer[offset + i] & 0xFF;
            final String strValue = Integer.toHexString(value).toUpperCase();
            final String str = "00".substring(strValue.length()) + strValue;
            stringBuffer.append(str);
            stringBuffer.append(' ");
        }
        
        return stringBuffer.toString();
    
public static java.lang.StringdumpOctets(java.nio.ByteBuffer[] bb)

        final StringBuffer stringBuffer = new StringBuffer();
        for(int i=0; i<bb.length; i++) {
            stringBuffer.append(dumpOctets(bb[i]));
        }
        
        return stringBuffer.toString();
    
public static java.lang.StringdumpOctets(java.nio.ByteBuffer buffer)

        return dumpOctets(buffer, buffer.position(), buffer.limit() - buffer.position());
    
public static java.lang.StringdumpOctets(java.nio.ByteBuffer buffer, int offset, int length)

        final byte[] array = new byte[length];
        final int position = buffer.position();
        buffer.position(offset);
        buffer.get(array);
        buffer.position(position);
        return dumpBytes(array);