@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("partCode="); sb.append(typeCodeToString(this.typeCode)); sb.append(" partLength=" + getLength()); // sb.append(" partBytes="); // byte[] b = getSerializedForm(); // if (b == null) { // sb.append("null"); // } // else { // sb.append("("); // for (int i = 0; i < b.length; i ++) { // sb.append(Integer.toString(b[i])); // sb.append(" "); // } // sb.append(")"); // } return sb.toString(); } }
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("partCode="); sb.append(typeCodeToString(this.typeCode)); sb.append(" partLength=" + getLength()); // sb.append(" partBytes="); // byte[] b = getSerializedForm(); // if (b == null) { // sb.append("null"); // } // else { // sb.append("("); // for (int i = 0; i < b.length; i ++) { // sb.append(Integer.toString(b[i])); // sb.append(" "); // } // sb.append(")"); // } return sb.toString(); }
/** * Write the contents of this part to the specified byte buffer. */ public final void sendTo(ByteBuffer buf) { if (getLength() > 0) { if (this.part instanceof byte[]) { buf.put((byte[])this.part); } else { HeapDataOutputStream hdos = (HeapDataOutputStream)this.part; hdos.sendTo(buf); hdos.rewind(); } } } /**
/** * Write the contents of this part to the specified output stream. */ public final void sendTo(OutputStream out) throws IOException { if (getLength() > 0) { if (this.part instanceof byte[]) { byte[] bytes = (byte[])this.part; out.write(bytes, 0, bytes.length); } else { HeapDataOutputStream hdos = (HeapDataOutputStream)this.part; hdos.sendTo(out); hdos.rewind(); } } } /**
if (getLength() > 0) { final int BUF_MAX = buf.capacity(); if (this.part instanceof byte[]) {
public int getInt() { if (!isBytes()) { Assert.assertTrue(false, "expected int part to be of type BYTE, part = " + this.toString()); } if (getLength() != 4) { Assert.assertTrue(false, "expected int length to be 4 but it was " + getLength() + "; part = " + this.toString()); } byte[] bytes = getSerializedForm(); return (((bytes[0]) << 24) & 0xFF000000) | (((bytes[1]) << 16) & 0x00FF0000) | (((bytes[2]) << 8) & 0x0000FF00) | ((bytes[3]) & 0x000000FF); }
public int getInt() { if (!isBytes()) { Assert.assertTrue(false, "expected int part to be of type BYTE, part = " + this.toString()); } if (getLength() != 4) { Assert.assertTrue(false, "expected int length to be 4 but it was " + getLength() + "; part = " + this.toString()); } byte[] bytes = getSerializedForm(); return decodeInt(bytes, 0); }
if (getLength() > 0) { final int BUF_MAX = buf.capacity(); if (this.part instanceof byte[]) {
public long getLong() { if (!isBytes()) { Assert.assertTrue(false, "expected long part to be of type BYTE, part = " + this.toString()); } if (getLength() != 8) { Assert.assertTrue(false, "expected long length to be 8 but it was " + getLength() + "; part = " + this.toString()); } byte[] bytes = getSerializedForm(); return ((((long)bytes[0]) << 56) & 0xFF00000000000000l) | ((((long)bytes[1]) << 48) & 0x00FF000000000000l) | ((((long)bytes[2]) << 40) & 0x0000FF0000000000l) | ((((long)bytes[3]) << 32) & 0x000000FF00000000l) | ((((long)bytes[4]) << 24) & 0x00000000FF000000l) | ((((long)bytes[5]) << 16) & 0x0000000000FF0000l) | ((((long)bytes[6]) << 8) & 0x000000000000FF00l) | ( bytes[7] & 0x00000000000000FFl); }
public long getLong() { if (!isBytes()) { Assert.assertTrue(false, "expected long part to be of type BYTE, part = " + this.toString()); } if (getLength() != 8) { Assert.assertTrue(false, "expected long length to be 8 but it was " + getLength() + "; part = " + this.toString()); } byte[] bytes = getSerializedForm(); return ((((long)bytes[0]) << 56) & 0xFF00000000000000l) | ((((long)bytes[1]) << 48) & 0x00FF000000000000l) | ((((long)bytes[2]) << 40) & 0x0000FF0000000000l) | ((((long)bytes[3]) << 32) & 0x000000FF00000000l) | ((((long)bytes[4]) << 24) & 0x00000000FF000000l) | ((((long)bytes[5]) << 16) & 0x0000000000FF0000l) | ((((long)bytes[6]) << 8) & 0x000000000000FF00l) | ( bytes[7] & 0x00000000000000FFl); }
if (getLength() > 0) { if (this.part instanceof byte[]) { buf.put((byte[])this.part);
if (getLength() > 0) { if (this.part instanceof byte[]) { byte[] bytes = (byte[])this.part;