blob: f71d28185018c1c4fefb277620e4ca7eeec94166 [file] [log] [blame]
diff --git a/src/main/java/com/google/protobuf/CodedInputStream.java b/src/main/java/com/google/protobuf/CodedInputStream.java
index bcd5639e8..b649d23a4 100644
--- a/src/main/java/com/google/protobuf/CodedInputStream.java
+++ b/src/main/java/com/google/protobuf/CodedInputStream.java
@@ -202,11 +202,7 @@ public abstract class CodedInputStream {
}
/** Create a new CodedInputStream wrapping the given {@link ByteInput}. */
- public static CodedInputStream newInstance(ByteInput buf, boolean bufferIsImmutable) {
- return new ByteInputDecoder(buf, bufferIsImmutable);
- }
-
- public static CodedInputStream newInstance(ByteInput buf, int off, int len, boolean bufferIsImmutable) {
+ static CodedInputStream newInstance(ByteInput buf, int off, int len, boolean bufferIsImmutable) {
return new ByteInputDecoder(buf, off, len, bufferIsImmutable);
}
diff --git a/src/main/java/com/google/protobuf/UnsafeByteOperations.java b/src/main/java/com/google/protobuf/UnsafeByteOperations.java
index bcaf1d2f3..d207f2be7 100644
--- a/src/main/java/com/google/protobuf/UnsafeByteOperations.java
+++ b/src/main/java/com/google/protobuf/UnsafeByteOperations.java
@@ -98,6 +98,17 @@ public final class UnsafeByteOperations {
return ByteString.wrap(buffer);
}
+ /**
+ * An unsafe operation that returns a {@link ByteString} that is backed by the provided buffer.
+ * @param buffer the ByteInput buffer to be wrapped
+ * @param offset the offset of the wrapped byteinput
+ * @param length the number of bytes of the byteinput
+ * @return a {@link ByteString} backed by the provided buffer
+ */
+ public static ByteString unsafeWrap(ByteInput buffer, int offset, int len) {
+ return ByteString.wrap(buffer, offset, len);
+ }
+
/**
* Writes the given {@link ByteString} to the provided {@link ByteOutput}. Calling this method may
* result in multiple operations on the target {@link ByteOutput} (i.e. for roped {@link