Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion simple '.proto' structure

Received: by 10.236.131.104 with SMTP id l68mr9095327yhi.3.1328827873044;
        Thu, 09 Feb 2012 14:51:13 -0800 (PST)
X-BeenThere: protobuf@googlegroups.com
Received: by 10.101.204.32 with SMTP id g32ls1966344anq.7.gmail; Thu, 09 Feb
 2012 14:51:09 -0800 (PST)
Received: by 10.101.9.1 with SMTP id m1mr2734002ani.17.1328827869201;
        Thu, 09 Feb 2012 14:51:09 -0800 (PST)
Received: by 10.101.9.1 with SMTP id m1mr2734000ani.17.1328827869187;
        Thu, 09 Feb 2012 14:51:09 -0800 (PST)
Return-Path: <henner.zel...@googlemail.com>
Received: from mail-yx0-f171.google.com (mail-yx0-f171.google.com [209.85.213.171])
        by gmr-mx.google.com with ESMTPS id o45si2013116yhj.4.2012.02.09.14.51.09
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 09 Feb 2012 14:51:09 -0800 (PST)
Received-SPF: pass (google.com: domain of henner.zel...@googlemail.com designates 209.85.213.171 as permitted sender) client-ip=209.85.213.171;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henner.zel...@googlemail.com designates 209.85.213.171 as permitted sender) smtp.mail=henner.zel...@googlemail.com; dkim=pass (test mode) header...@googlemail.com
Received: by mail-yx0-f171.google.com with SMTP id m7so1827775yen.16
        for <protobuf@googlegroups.com>; Thu, 09 Feb 2012 14:51:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlemail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type:content-transfer-encoding;
        bh=shBVOmKYMQg/1teHmlX3KxUkuYpL88FA/YHngbSpShw=;
        b=DyQ299tnAsl5VHG9Ncl886tNXZF5S4fydqnxvmXR8aGezH9sq8wyZW6Rcwq408NEvB
         E9RIqd5ABmInIx5C7QKcsKWoapRiOf1nmht05yny+L6BZ4Xo3AfjIyQHKDPEMBJ2Huz8
         uFtePNHFIeGCrIQQIakU+SxPRRM/cNEPPf39g=
MIME-Version: 1.0
Received: by 10.50.95.195 with SMTP id dm3mr6391071igb.9.1328827869052; Thu,
 09 Feb 2012 14:51:09 -0800 (PST)
Received: by 10.231.30.139 with HTTP; Thu, 9 Feb 2012 14:51:09 -0800 (PST)
In-Reply-To: <7617be04-8334-42be-88e1-b91a009bf...@qt7g2000pbc.googlegroups.com>
References: <7617be04-8334-42be-88e1-b91a009bf...@qt7g2000pbc.googlegroups.com>
Date: Thu, 9 Feb 2012 14:51:09 -0800
Message-ID: <CAEQqtJz03WMqdsqTFD0bGd-cW9-21W1dhcby8mMZt83QJzo...@mail.gmail.com>
Subject: Re: [protobuf] simple '.proto' structure
From: Henner Zeller <henner.zel...@googlemail.com>
To: MohanR <radhakrishnan.mo...@gmail.com>
Cc: Protocol Buffers <protobuf@googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thu, Feb 9, 2012 at 03:33, MohanR <radhakrishnan.mo...@gmail.com> wrote:
> Hi,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 I tried to write and read a simple '.proto' s=
tructure but
> when I read it back I get an exception. Is there something wrong with
> the way I read ?
>
>
> Thanks.
>
> --------------proto-------------
>
> package message;
>
> message Load {
>
> =C2=A0enum LoadType {
> =C2=A0 =C2=A0HIGH =3D 0;
> =C2=A0 =C2=A0MEDIUM =3D 1;
> =C2=A0 =C2=A0LOW =3D 2;
> =C2=A0}
> =C2=A0message LoadBalance {
> =C2=A0 =C2=A0optional LoadType type =3D 2 [default =3D MEDIUM];
> =C2=A0}
> =C2=A0optional LoadBalance loadbalancer =3D 1;
> }
>
> -------------Write-----------
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0Message.Load message =3D
> Message.Load.newBuilder().setLoadbalancer(
>
> Message.Load.LoadBalance.newBuilder().setType( Message.Load.LoadType.HIGH=
)).build();

uhm, where do you set the value ? I'd expected something like
SerializeToString()
>
> ------------Read----------
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Message.Load message =3D Message=
.Load.parseFrom( value );
>
> -----------Exception--------
>
> InvalidProtocolBufferExceptionProtocol message contained an invalid
> tag (zero).
> com.google.protobuf.InvalidProtocolBufferException: Protocol message
> contained an invalid tag (zero).
> =C2=A0 =C2=A0 =C2=A0 =C2=A0at
> com.google.protobuf.InvalidProtocolBufferException.invalidTag(InvalidProt=
ocolBufferException.java:
> 68)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0at com.google.protobuf.CodedInputStream.readTa=
g(CodedInputStream.java:
> 108)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0at message.Message$Load$Builder.mergeFrom(Mess=
age.java:723)
>
> --
> You received this message because you are subscribed to the Google Groups=
 "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to protobuf+unsubscribe@google=
groups.com.
> For more options, visit this group at http://groups.google.com/group/prot=
obuf?hl=3Den.
>