{"action":"created","issue":{"url":"https://api.github.com/repos/scala/pickling/issues/345","labels_url":"https://api.github.com/repos/scala/pickling/issues/345/labels{/name}","comments_url":"https://api.github.com/repos/scala/pickling/issues/345/comments","events_url":"https://api.github.com/repos/scala/pickling/issues/345/events","html_url":"https://github.com/scala/pickling/issues/345","id":92663322,"number":345,"title":"java.nio.ByteBuffer pickle/unpickle question","user":{"login":"helena","id":406103,"avatar_url":"https://avatars.githubusercontent.com/u/406103?v=3","gravatar_id":"","url":"https://api.github.com/users/helena","html_url":"https://github.com/helena","followers_url":"https://api.github.com/users/helena/followers","following_url":"https://api.github.com/users/helena/following{/other_user}","gists_url":"https://api.github.com/users/helena/gists{/gist_id}","starred_url":"https://api.github.com/users/helena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helena/subscriptions","organizations_url":"https://api.github.com/users/helena/orgs","repos_url":"https://api.github.com/users/helena/repos","events_url":"https://api.github.com/users/helena/events{/privacy}","received_events_url":"https://api.github.com/users/helena/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-02T15:20:18Z","updated_at":"2015-07-02T17:03:51Z","closed_at":null,"body":"I am working with something where input values are ByteBuffers, and when I test\r\nval in: ByteBuffer\r\n\r\nval ser = in.pickle\r\nval des = ser.unpickle[ByteBuffer]\r\n\r\nI consistently get\r\nin = java.nio.HeapByteBuffer[pos=0 lim=4 cap=4]\r\nout = java.nio.HeapByteBuffer[pos=0 lim=0 cap=0]\r\n\r\nWondering what I am doing wrong? \r\nI'm seeing if I can use pickling in akka serialization for a custom serializer vs java or kryo.\r\nThanks :)"},"comment":{"url":"https://api.github.com/repos/scala/pickling/issues/comments/118093673","html_url":"https://github.com/scala/pickling/issues/345#issuecomment-118093673","issue_url":"https://api.github.com/repos/scala/pickling/issues/345","id":118093673,"user":{"login":"phaller","id":289943,"avatar_url":"https://avatars.githubusercontent.com/u/289943?v=3","gravatar_id":"","url":"https://api.github.com/users/phaller","html_url":"https://github.com/phaller","followers_url":"https://api.github.com/users/phaller/followers","following_url":"https://api.github.com/users/phaller/following{/other_user}","gists_url":"https://api.github.com/users/phaller/gists{/gist_id}","starred_url":"https://api.github.com/users/phaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phaller/subscriptions","organizations_url":"https://api.github.com/users/phaller/orgs","repos_url":"https://api.github.com/users/phaller/repos","events_url":"https://api.github.com/users/phaller/events{/privacy}","received_events_url":"https://api.github.com/users/phaller/received_events","type":"User","site_admin":false},"created_at":"2015-07-02T17:03:51Z","updated_at":"2015-07-02T17:03:51Z","body":"I just realized I didn't fully explain why this registration is required. ;-) The issue is that in the Akka serializer you'd want to do:\r\n```scala\r\nval p = BinaryPickle(byteArray)\r\nval obj = p.unpickle[Any]\r\n```\r\nSince we're only providing `Any` as target type, normally Pickling would fall back to using a generic unpickler based on runtime reflection. However, if a specialized pickler is found in `GlobalRegistry` it is used instead. We'd probably want to use specialized picklers in *all* cases for performance, and to have a compile-time guarantee that fully-static picklers are generated."}}