Mercurial > hg > Members > nobuyasu > PracticeJava
changeset 6:b82cdd44b1c1
modified PracticeEnum.java
author | one |
---|---|
date | Mon, 10 Jun 2013 00:21:06 +0900 |
parents | 6fbdb09fb0e6 |
children | 98144dbff410 |
files | src/ie/oshiro/messagepack/enumpractice/PracticeEnum.java |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ie/oshiro/messagepack/enumpractice/PracticeEnum.java Sun Jun 09 23:07:43 2013 +0900 +++ b/src/ie/oshiro/messagepack/enumpractice/PracticeEnum.java Mon Jun 10 00:21:06 2013 +0900 @@ -28,6 +28,7 @@ Command convertedC = msgpack.convert(cValue, Command.class); System.out.println("convertedC = "+ convertedC); + /* Success */ ByteBuffer bb = ByteBuffer.allocate(6); bb.putChar('a'); bb.putChar('b'); @@ -35,7 +36,15 @@ Value bbValue = msgpack.unconvert(bb.array()); byte[] convertedBB = msgpack.convert(bbValue, byte[].class); String str = new String(convertedBB); - System.out.println("ByteBuffer : "+str); + System.out.println("ByteBuffer -> byte[] : "+str); + + /* Fail */ + MessagePack msgpack2 = new MessagePack(); + Value v = msgpack2.unconvert(bb); + ByteBuffer b = msgpack.convert(v, ByteBuffer.class); + String str2 = new String(b.array()); + System.out.println("ByteBuffer : "+str2); + }