Package com.google.protobuf

Examples of com.google.protobuf.CodedInputStream$SkippedDataSink


            }
        }

        @Override
        public CounterRollup fromByteBuffer(ByteBuffer byteBuffer) {
            CodedInputStream in = CodedInputStream.newInstance(byteBuffer.array());
            try {
                byte version = in.readRawByte();
                if (version != VERSION_1_COUNTER_ROLLUP)
                    throw new SerializationException(String.format("Unexpected serialization version: %d", (int)version));
                return deserializeV1CounterRollup(in);
            } catch (Exception ex) {
                throw new RuntimeException(ex);
View Full Code Here


    //read the PostScript
    //get length of PostScript
    int psLen = buffer.get(readSize - 1) & 0xff;
    ensureOrcFooter(file, path, psLen, buffer);
    int psOffset = readSize - 1 - psLen;
    CodedInputStream in = CodedInputStream.newInstance(buffer.array(),
      buffer.arrayOffset() + psOffset, psLen);
    OrcProto.PostScript ps = OrcProto.PostScript.parseFrom(in);

    checkOrcVersion(LOG, path, ps.getVersionList());
View Full Code Here

        final ByteBuf bb = msg.content();
        byte[] buf = new byte[bb.readableBytes()];
       
        bb.readBytes(buf);
       
        CodedInputStream in = CodedInputStream.newInstance(buf);
        final int numMetrics = in.readRawVarint32();
        List<Metric> metrics = new ArrayList<Metric>(numMetrics);
       
        for (int i = 0; i < numMetrics; i++) {
       
            String tenantId = in.readString();
            String metricName = in.readString();
            DataType type = new DataType(in.readString());
            long collectionTime = in.readRawVarint64();
            int ttlSecs = in.readRawVarint32();
            String units = in.readString();
            Object value = null;
            if (type.equals(DataType.BOOLEAN))
                value = in.readBool();
            else if (type.equals(DataType.DOUBLE))
                value = in.readDouble();
            else if (type.equals(DataType.INT))
                value = in.readRawVarint32();
            else if (type.equals(DataType.LONG))
                value = in.readRawVarint64();
            else if (type.equals(DataType.STRING))
                value = in.readString();
           
            if (value != null) {
                metrics.add(new Metric(
                        Locator.createLocatorFromPathComponents(tenantId, metricName),
                        value,
View Full Code Here

   public void parse(TagHandler tagHandler, Descriptors.Descriptor messageDescriptor, InputStream input) throws IOException {
      if (messageDescriptor == null) {
         throw new IllegalArgumentException("messageDescriptor cannot be null");
      }
      CodedInputStream in = CodedInputStream.newInstance(input);

      parse(tagHandler, messageDescriptor, in);
   }
View Full Code Here

   public void parse(TagHandler tagHandler, Descriptors.Descriptor messageDescriptor, byte[] buf, int off, int len) throws IOException {
      if (messageDescriptor == null) {
         throw new IllegalArgumentException("messageDescriptor cannot be null");
      }
      CodedInputStream in = CodedInputStream.newInstance(buf, off, len);

      parse(tagHandler, messageDescriptor, in);
   }
View Full Code Here

   public void parse(TagHandler tagHandler, Descriptors.Descriptor messageDescriptor, byte[] buf) throws IOException {
      if (messageDescriptor == null) {
         throw new IllegalArgumentException("messageDescriptor cannot be null");
      }
      CodedInputStream in = CodedInputStream.newInstance(buf);

      parse(tagHandler, messageDescriptor, in);
   }
View Full Code Here

      Object o = messageContext.unknownFieldSet.consumeTag(expectedTag);
      if (o != null) {
         return convertWireTypeToJavaType(type, o);
      }

      CodedInputStream in = messageContext.in;
      while (true) {
         int tag = in.readTag();
         if (tag == 0) {
            break;
         }
         if (tag == expectedTag) {
            switch (fd.getType()) {
               case DOUBLE:
                  return in.readDouble();
               case FLOAT:
                  return in.readFloat();
               case BOOL:
                  return in.readBool();
               case STRING:
                  return in.readString();
               case BYTES:
                  return in.readBytes().toByteArray();
               case INT32:
                  return in.readInt32();
               case SFIXED32:
                  return in.readSFixed32();
               case FIXED32:
                  return in.readFixed32();
               case UINT32:
                  return in.readUInt32();
               case SINT32:
                  return in.readSInt32();
               case INT64:
                  return in.readInt64();
               case UINT64:
                  return in.readUInt64();
               case FIXED64:
                  return in.readFixed64();
               case SFIXED64:
                  return in.readSFixed64();
               case SINT64:
                  return in.readSInt64();
               default:
                  throw new IOException("Unexpected field type : " + fd.getType());
            }
         }
         messageContext.unknownFieldSet.readSingleField(tag, in);
View Full Code Here

         Object o = messageContext.unknownFieldSet.consumeTag(expectedTag);
         if (o == null) {
            break;
         }
         ByteString byteString = (ByteString) o;
         CodedInputStream codedInputStream = byteString.newCodedInput();
         collection.add(readNestedObject(fieldName, fd, elementClass, codedInputStream, byteString.size()));
      }

      while (true) {
         int tag = messageContext.in.readTag();
View Full Code Here

    ByteBuffer buffer = ByteBuffer.allocate(readSize);
    file.readFully(buffer.array(), buffer.arrayOffset() + buffer.position(),
      buffer.remaining());
    int psLen = buffer.get(readSize - 1);
    int psOffset = readSize - 1 - psLen;
    CodedInputStream in = CodedInputStream.newInstance(buffer.array(),
      buffer.arrayOffset() + psOffset, psLen);
    OrcProto.PostScript ps = OrcProto.PostScript.parseFrom(in);
    int footerSize = (int) ps.getFooterLength();
    bufferSize = (int) ps.getCompressionBlockSize();
    switch (ps.getCompression()) {
View Full Code Here

    ByteBuffer buffer = ByteBuffer.allocate(readSize);
    InStream.read(file, size - readSize, buffer.array(), buffer.arrayOffset() + buffer.position(),
        buffer.remaining());
    int psLen = buffer.get(readSize - 1);
    int psOffset = readSize - 1 - psLen;
    CodedInputStream in = CodedInputStream.newInstance(buffer.array(),
      buffer.arrayOffset() + psOffset, psLen);
    OrcProto.PostScript ps = OrcProto.PostScript.parseFrom(in);
    int footerSize = (int) ps.getFooterLength();
    bufferSize = (int) ps.getCompressionBlockSize();
    switch (ps.getCompression()) {
View Full Code Here

TOP

Related Classes of com.google.protobuf.CodedInputStream$SkippedDataSink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.