/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
package com.examples.abelanav2.grpc;
@SuppressWarnings("hiding")
public final class PhotoListResponse extends
com.google.protobuf.nano.MessageNano {
private static volatile PhotoListResponse[] _emptyArray;
public static PhotoListResponse[] emptyArray() {
// Lazily initializes the empty array
if (_emptyArray == null) {
synchronized (
com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {
if (_emptyArray == null) {
_emptyArray = new PhotoListResponse[0];
}
}
}
return _emptyArray;
}
// optional .abelanav2.grpc.Error error = 1;
public com.examples.abelanav2.grpc.Error error;
// repeated .abelanav2.grpc.Photo photo = 2;
public com.examples.abelanav2.grpc.Photo[] photo;
// optional int64 next_page = 3;
public long nextPage;
public PhotoListResponse() {
clear();
}
public PhotoListResponse clear() {
error = null;
photo = com.examples.abelanav2.grpc.Photo.emptyArray();
nextPage = 0L;
cachedSize = -1;
return this;
}
@Override
public void writeTo(com.google.protobuf.nano.CodedOutputByteBufferNano output)
throws java.io.IOException {
if (this.error != null) {
output.writeMessage(1, this.error);
}
if (this.photo != null && this.photo.length > 0) {
for (int i = 0; i < this.photo.length; i++) {
com.examples.abelanav2.grpc.Photo element = this.photo[i];
if (element != null) {
output.writeMessage(2, element);
}
}
}
if (this.nextPage != 0L) {
output.writeInt64(3, this.nextPage);
}
super.writeTo(output);
}
@Override
protected int computeSerializedSize() {
int size = super.computeSerializedSize();
if (this.error != null) {
size += com.google.protobuf.nano.CodedOutputByteBufferNano
.computeMessageSize(1, this.error);
}
if (this.photo != null && this.photo.length > 0) {
for (int i = 0; i < this.photo.length; i++) {
com.examples.abelanav2.grpc.Photo element = this.photo[i];
if (element != null) {
size += com.google.protobuf.nano.CodedOutputByteBufferNano
.computeMessageSize(2, element);
}
}
}
if (this.nextPage != 0L) {
size += com.google.protobuf.nano.CodedOutputByteBufferNano
.computeInt64Size(3, this.nextPage);
}
return size;
}
@Override
public PhotoListResponse mergeFrom(
com.google.protobuf.nano.CodedInputByteBufferNano input)
throws java.io.IOException {
while (true) {
int tag = input.readTag();
switch (tag) {
case 0:
return this;
default: {
if (!com.google.protobuf.nano.WireFormatNano.parseUnknownField(input, tag)) {
return this;
}
break;
}
case 10: {
if (this.error == null) {
this.error = new com.examples.abelanav2.grpc.Error();
}
input.readMessage(this.error);
break;
}
case 18: {
int arrayLength = com.google.protobuf.nano.WireFormatNano
.getRepeatedFieldArrayLength(input, 18);
int i = this.photo == null ? 0 : this.photo.length;
com.examples.abelanav2.grpc.Photo[] newArray =
new com.examples.abelanav2.grpc.Photo[i + arrayLength];
if (i != 0) {
java.lang.System.arraycopy(this.photo, 0, newArray, 0, i);
}
for (; i < newArray.length - 1; i++) {
newArray[i] = new com.examples.abelanav2.grpc.Photo();
input.readMessage(newArray[i]);
input.readTag();
}
// Last one without readTag.
newArray[i] = new com.examples.abelanav2.grpc.Photo();
input.readMessage(newArray[i]);
this.photo = newArray;
break;
}
case 24: {
this.nextPage = input.readInt64();
break;
}
}
}
}
public static PhotoListResponse parseFrom(byte[] data)
throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {
return com.google.protobuf.nano.MessageNano.mergeFrom(new PhotoListResponse(), data);
}
public static PhotoListResponse parseFrom(
com.google.protobuf.nano.CodedInputByteBufferNano input)
throws java.io.IOException {
return new PhotoListResponse().mergeFrom(input);
}
}