OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 InputStream input, ExtensionRegistryLite extensionRegistry) | 225 InputStream input, ExtensionRegistryLite extensionRegistry) |
226 throws InvalidProtocolBufferException { | 226 throws InvalidProtocolBufferException { |
227 int size; | 227 int size; |
228 try { | 228 try { |
229 int firstByte = input.read(); | 229 int firstByte = input.read(); |
230 if (firstByte == -1) { | 230 if (firstByte == -1) { |
231 return null; | 231 return null; |
232 } | 232 } |
233 size = CodedInputStream.readRawVarint32(firstByte, input); | 233 size = CodedInputStream.readRawVarint32(firstByte, input); |
234 } catch (IOException e) { | 234 } catch (IOException e) { |
235 throw new InvalidProtocolBufferException(e.getMessage()); | 235 throw new InvalidProtocolBufferException(e); |
236 } | 236 } |
237 InputStream limitedInput = new LimitedInputStream(input, size); | 237 InputStream limitedInput = new LimitedInputStream(input, size); |
238 return parsePartialFrom(limitedInput, extensionRegistry); | 238 return parsePartialFrom(limitedInput, extensionRegistry); |
239 } | 239 } |
240 | 240 |
241 @Override | 241 @Override |
242 public MessageType parsePartialDelimitedFrom(InputStream input) | 242 public MessageType parsePartialDelimitedFrom(InputStream input) |
243 throws InvalidProtocolBufferException { | 243 throws InvalidProtocolBufferException { |
244 return parsePartialDelimitedFrom(input, EMPTY_REGISTRY); | 244 return parsePartialDelimitedFrom(input, EMPTY_REGISTRY); |
245 } | 245 } |
246 | 246 |
247 @Override | 247 @Override |
248 public MessageType parseDelimitedFrom(InputStream input, ExtensionRegistryLite
extensionRegistry) | 248 public MessageType parseDelimitedFrom(InputStream input, ExtensionRegistryLite
extensionRegistry) |
249 throws InvalidProtocolBufferException { | 249 throws InvalidProtocolBufferException { |
250 return checkMessageInitialized( | 250 return checkMessageInitialized( |
251 parsePartialDelimitedFrom(input, extensionRegistry)); | 251 parsePartialDelimitedFrom(input, extensionRegistry)); |
252 } | 252 } |
253 | 253 |
254 @Override | 254 @Override |
255 public MessageType parseDelimitedFrom(InputStream input) throws InvalidProtoco
lBufferException { | 255 public MessageType parseDelimitedFrom(InputStream input) throws InvalidProtoco
lBufferException { |
256 return parseDelimitedFrom(input, EMPTY_REGISTRY); | 256 return parseDelimitedFrom(input, EMPTY_REGISTRY); |
257 } | 257 } |
258 } | 258 } |
OLD | NEW |