Package com.google.protobuf
Interface ByteString.ByteArrayCopier
-
- All Known Implementing Classes:
ByteString.ArraysByteArrayCopier
,ByteString.SystemByteArrayCopier
- Enclosing class:
- ByteString
private static interface ByteString.ByteArrayCopier
An interface to efficiently copybyte[]
.One of the noticeable costs of copying a byte[] into a new array using
System.arraycopy
is nullification of a new buffer before the copy. It has been shown the Hotspot VM is capable to intrisicfyArrays.copyOfRange
operation to avoid this expensive nullification and provide substantial performance gain. Unfortunately this does not hold on Android runtimes and could make the copy slightly slower due to additional code in theArrays.copyOfRange
. Thus we provide two different implementation for array copier for Hotspot and Android runtimes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
copyFrom(byte[] bytes, int offset, int size)
Copies the specified range of the specified array into a new array
-