apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Weise (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (APEXMALHAR-2178) Unnecessary byte array copy in KryoSerializableStreamCodec
Date Wed, 17 Aug 2016 20:28:20 GMT

     [ 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)

Mime
View raw message