@Test public void test7() { byte[] data = encodeString(""); assertArrayEquals(new byte[]{(byte) 0x80}, data); byte[] expected = {(byte) 0x90, (byte) 0x45, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x75, (byte) 0x6D, (byte) 0x4A, (byte) 0x20, (byte) 0x43, (byte) 0x6C, (byte) 0x69, (byte) 0x65, (byte) 0x6E, (byte) 0x74}; String test = "EthereumJ Client"; data = encodeString(test); assertArrayEquals(expected, data); String test2 = "Ethereum(++)/ZeroGox/v0.5.0/ncurses/Linux/g++"; byte[] expected2 = {(byte) 0xAD, (byte) 0x45, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x75, (byte) 0x6D, (byte) 0x28, (byte) 0x2B, (byte) 0x2B, (byte) 0x29, (byte) 0x2F, (byte) 0x5A, (byte) 0x65, (byte) 0x72, (byte) 0x6F, (byte) 0x47, (byte) 0x6F, (byte) 0x78, (byte) 0x2F, (byte) 0x76, (byte) 0x30, (byte) 0x2E, (byte) 0x35, (byte) 0x2E, (byte) 0x30, (byte) 0x2F, (byte) 0x6E, (byte) 0x63, (byte) 0x75, (byte) 0x72, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x2F, (byte) 0x4C, (byte) 0x69, (byte) 0x6E, (byte) 0x75, (byte) 0x78, (byte) 0x2F, (byte) 0x67, (byte) 0x2B, (byte) 0x2B}; data = encodeString(test2); assertArrayEquals(expected2, data); String test3 = "Ethereum(++)/ZeroGox/v0.5.0/ncurses/Linux/g++Ethereum(++)/ZeroGox/v0.5.0/ncurses/Linux/g++"; byte[] expected3 = {(byte) 0xB8, (byte) 0x5A, (byte) 0x45, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x75, (byte) 0x6D, (byte) 0x28, (byte) 0x2B, (byte) 0x2B, (byte) 0x29, (byte) 0x2F, (byte) 0x5A, (byte) 0x65, (byte) 0x72, (byte) 0x6F, (byte) 0x47, (byte) 0x6F, (byte) 0x78, (byte) 0x2F, (byte) 0x76, (byte) 0x30, (byte) 0x2E, (byte) 0x35, (byte) 0x2E, (byte) 0x30, (byte) 0x2F, (byte) 0x6E, (byte) 0x63, (byte) 0x75, (byte) 0x72, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x2F, (byte) 0x4C, (byte) 0x69, (byte) 0x6E, (byte) 0x75, (byte) 0x78, (byte) 0x2F, (byte) 0x67, (byte) 0x2B, (byte) 0x2B, (byte) 0x45, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x75, (byte) 0x6D, (byte) 0x28, (byte) 0x2B, (byte) 0x2B, (byte) 0x29, (byte) 0x2F, (byte) 0x5A, (byte) 0x65, (byte) 0x72, (byte) 0x6F, (byte) 0x47, (byte) 0x6F, (byte) 0x78, (byte) 0x2F, (byte) 0x76, (byte) 0x30, (byte) 0x2E, (byte) 0x35, (byte) 0x2E, (byte) 0x30, (byte) 0x2F, (byte) 0x6E, (byte) 0x63, (byte) 0x75, (byte) 0x72, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x2F, (byte) 0x4C, (byte) 0x69, (byte) 0x6E, (byte) 0x75, (byte) 0x78, (byte) 0x2F, (byte) 0x67, (byte) 0x2B, (byte) 0x2B}; data = encodeString(test3); assertArrayEquals(expected3, data); }
public static byte[] encodeString(String srcString) { return encodeElement(srcString.getBytes()); }
RLP { public static byte[] encodeString(String srcString) { return encodeElement(srcString.getBytes()); } }
RLP { public static byte[] encodeString(String srcString) { return encodeElement(srcString.getBytes()); }  }
RLP { public static byte[] encodeString(String srcString) { return encodeElement(srcString.getBytes()); }  static int decodeInt(byte[] data, int index); static long decodeLong(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int index); static byte[] decodeIP4Bytes(byte[] data, int index); static int getFirstListElement(byte[] payload, int pos); static int getNextElementIndex(byte[] payload, int pos); static byte getCommandCode(byte[] data); static RLPList decode2(byte[] msgData, int depthLimit); static RLPList decode2(byte[] msgData); static RLPList unwrapList(byte[] msgData); static RLPElement decode2OneItem(byte[] msgData, int startPos); static DecodeResult decode(byte[] data, int pos); static LList decodeLazyList(byte[] data); static LList decodeLazyList(byte[] data, int pos, int length); static byte[] encode(Object input); static byte[] encodeLength(int length, int offset); static byte[] encodeByte(byte singleByte); static byte[] encodeShort(short singleShort); static byte[] encodeInt(int singleInt); static byte[] encodeString(String srcString); static byte[] encodeBigInteger(BigInteger srcBigInteger); static byte[] encodeElement(byte[] srcData); static int calcElementPrefixSize(byte[] srcData); static byte[] encodeListHeader(int size); static byte[] encodeLongElementHeader(int length); static byte[] encodeSet(Set<ByteArrayWrapper> data); static byte[] wrapList(byte[] ... data); static byte[] encodeList(byte[]... elements); }
RLP { public static byte[] encodeString(String srcString) { return encodeElement(srcString.getBytes()); }  static int decodeInt(byte[] data, int index); static long decodeLong(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int index); static byte[] decodeIP4Bytes(byte[] data, int index); static int getFirstListElement(byte[] payload, int pos); static int getNextElementIndex(byte[] payload, int pos); static byte getCommandCode(byte[] data); static RLPList decode2(byte[] msgData, int depthLimit); static RLPList decode2(byte[] msgData); static RLPList unwrapList(byte[] msgData); static RLPElement decode2OneItem(byte[] msgData, int startPos); static DecodeResult decode(byte[] data, int pos); static LList decodeLazyList(byte[] data); static LList decodeLazyList(byte[] data, int pos, int length); static byte[] encode(Object input); static byte[] encodeLength(int length, int offset); static byte[] encodeByte(byte singleByte); static byte[] encodeShort(short singleShort); static byte[] encodeInt(int singleInt); static byte[] encodeString(String srcString); static byte[] encodeBigInteger(BigInteger srcBigInteger); static byte[] encodeElement(byte[] srcData); static int calcElementPrefixSize(byte[] srcData); static byte[] encodeListHeader(int size); static byte[] encodeLongElementHeader(int length); static byte[] encodeSet(Set<ByteArrayWrapper> data); static byte[] wrapList(byte[] ... data); static byte[] encodeList(byte[]... elements); static final byte[] EMPTY_ELEMENT_RLP; }