Search in sources :

Example 1 with CodedInputStream

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream in project hbase by apache.

the class ProtobufUtil method mergeFrom.

/**
   * This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
   * buffers when working with ByteStrings
   * @param builder current message builder
   * @param bs ByteString containing the
   * @throws IOException
   */
public static void mergeFrom(Message.Builder builder, ByteString bs) throws IOException {
    final CodedInputStream codedInput = bs.newCodedInput();
    codedInput.setSizeLimit(bs.size());
    builder.mergeFrom(codedInput);
    codedInput.checkLastTagWas(0);
}
Also used : CodedInputStream(org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream)

Example 2 with CodedInputStream

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream in project hbase by apache.

the class ProtobufUtil method mergeFrom.

/**
   * This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
   * buffers when working with byte arrays
   * @param builder current message builder
   * @param b byte array
   * @throws IOException
   */
public static void mergeFrom(Message.Builder builder, byte[] b) throws IOException {
    final CodedInputStream codedInput = CodedInputStream.newInstance(b);
    codedInput.setSizeLimit(b.length);
    builder.mergeFrom(codedInput);
    codedInput.checkLastTagWas(0);
}
Also used : CodedInputStream(org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream)

Example 3 with CodedInputStream

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream in project hbase by apache.

the class ProtobufUtil method mergeFrom.

/**
   * This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
   * buffers when working with byte arrays
   * @param builder current message builder
   * @param b byte array
   * @param offset
   * @param length
   * @throws IOException
   */
public static void mergeFrom(Message.Builder builder, byte[] b, int offset, int length) throws IOException {
    final CodedInputStream codedInput = CodedInputStream.newInstance(b, offset, length);
    codedInput.setSizeLimit(length);
    builder.mergeFrom(codedInput);
    codedInput.checkLastTagWas(0);
}
Also used : CodedInputStream(org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream)

Example 4 with CodedInputStream

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream in project hbase by apache.

the class ProtobufUtil method mergeFrom.

/**
   * This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
   * buffers where the message size is known
   * @param builder current message builder
   * @param in InputStream containing protobuf data
   * @param size known size of protobuf data
   * @throws IOException
   */
public static void mergeFrom(Message.Builder builder, InputStream in, int size) throws IOException {
    final CodedInputStream codedInput = CodedInputStream.newInstance(in);
    codedInput.setSizeLimit(size);
    builder.mergeFrom(codedInput);
    codedInput.checkLastTagWas(0);
}
Also used : CodedInputStream(org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream)

Example 5 with CodedInputStream

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream in project hbase by apache.

the class ProtobufUtil method mergeFrom.

/**
   * This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
   * buffers where the message size is not known
   * @param builder current message builder
   * @param in InputStream containing protobuf data
   * @throws IOException
   */
public static void mergeFrom(Message.Builder builder, InputStream in) throws IOException {
    final CodedInputStream codedInput = CodedInputStream.newInstance(in);
    codedInput.setSizeLimit(Integer.MAX_VALUE);
    builder.mergeFrom(codedInput);
    codedInput.checkLastTagWas(0);
}
Also used : CodedInputStream(org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream)

Aggregations

CodedInputStream (org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream)8 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)2 Path (org.apache.hadoop.fs.Path)2 InvalidProtocolBufferException (org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InterruptedIOException (java.io.InterruptedIOException)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorCompletionService (java.util.concurrent.ExecutorCompletionService)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 PathFilter (org.apache.hadoop.fs.PathFilter)1 LimitInputStream (org.apache.hadoop.hbase.io.LimitInputStream)1 SnapshotRegionManifest (org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest)1