Vlad Rozov created APEXMALHAR-2178:
--------------------------------------

             Summary: 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


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

Reply via email to