Public Member Functions | List of all members
com.google.protobuf.ByteString.ByteArrayCopier Interface Reference
Inheritance diagram for com.google.protobuf.ByteString.ByteArrayCopier:
Inheritance graph
[legend]

Public Member Functions

byte[] copyFrom (byte[] bytes, int offset, int size)
 
byte[] copyFrom (byte[] bytes, int offset, int size)
 

Detailed Description

An interface to efficiently copy

byte[]

.

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 intrisicfy

Arrays.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 the

Arrays.copyOfRange

. Thus we provide two different implementation for array copier for Hotspot and Android runtimes.

Definition at line 98 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ByteString.java.

Member Function Documentation

◆ copyFrom() [1/2]

byte [] com.google.protobuf.ByteString.ByteArrayCopier.copyFrom ( byte[]  bytes,
int  offset,
int  size 
)

◆ copyFrom() [2/2]

byte [] com.google.protobuf.ByteString.ByteArrayCopier.copyFrom ( byte[]  bytes,
int  offset,
int  size 
)

The documentation for this interface was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:02