You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by "Thomas Weise (JIRA)" <ji...@apache.org> on 2016/08/17 20:28:20 UTC

[jira] [Updated] (APEXMALHAR-2178) Unnecessary byte array copy in KryoSerializableStreamCodec

     [ https://issues.apache.org/jira/browse/APEXMALHAR-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Weise updated APEXMALHAR-2178:
-------------------------------------
    Labels: newbie  (was: )

> Unnecessary byte array copy in KryoSerializableStreamCodec
> ----------------------------------------------------------
>
>                 Key: APEXMALHAR-2178
>                 URL: https://issues.apache.org/jira/browse/APEXMALHAR-2178
>             Project: Apache Apex Malhar
>          Issue Type: Improvement
>            Reporter: Vlad Rozov
>              Labels: newbie
>
> {noformat}
>   public Slice toByteArray(T info)
>   {
>     ByteArrayOutputStream os = new ByteArrayOutputStream();
>     Output output = new Output(os);
>     kryo.writeClassAndObject(output, info);
>     output.flush();
>     return new Slice(os.toByteArray(), 0, os.toByteArray().length);
>   }
> {noformat}
> It is not necessary to call os.toByteArray().length as it will result in duplicate copy of the byte array.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)