aboutsummaryrefslogtreecommitdiff
path: root/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2018-08-08 17:00:41 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2018-08-08 17:00:41 -0700
commit6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 (patch)
treee575738adf52d24b883cca5e8928a5ded31caba1 /java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
parente7746f487cb9cca685ffb1b3d7dccc5554b618a4 (diff)
downloadprotobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.gz
protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.bz2
protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.zip
Down-integrate from google3.
Diffstat (limited to 'java/core/src/main/java/com/google/protobuf/UnsafeUtil.java')
-rw-r--r--java/core/src/main/java/com/google/protobuf/UnsafeUtil.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
index d84ef3c5..f822ce51 100644
--- a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
+++ b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
@@ -33,6 +33,7 @@ package com.google.protobuf;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.logging.Level;
@@ -146,6 +147,10 @@ final class UnsafeUtil {
return MEMORY_ACCESSOR.getObject(target, offset);
}
+ static void putObject(Object target, long offset, Object value) {
+ MEMORY_ACCESSOR.putObject(target, offset, value);
+ }
+
static byte getByte(byte[] target, long index) {
return MEMORY_ACCESSOR.getByte(target, BYTE_ARRAY_BASE_OFFSET + index);
}
@@ -370,12 +375,6 @@ final class UnsafeUtil {
return field != null && field.getType() == long.class ? field : null;
}
- /** Finds the value field within a {@link String}. */
- private static Field stringValueField() {
- Field field = field(String.class, "value");
- return field != null && field.getType() == char[].class ? field : null;
- }
-
/**
* Returns the offset of the provided field, or {@code -1} if {@code sun.misc.Unsafe} is not
* available.