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 29 matching lines...) Expand all Loading... |
40 * | 40 * |
41 * This class contains constants and helper functions useful for dealing with | 41 * This class contains constants and helper functions useful for dealing with |
42 * the Protocol Buffer wire format. | 42 * the Protocol Buffer wire format. |
43 * | 43 * |
44 * @author kenton@google.com Kenton Varda | 44 * @author kenton@google.com Kenton Varda |
45 */ | 45 */ |
46 public final class WireFormat { | 46 public final class WireFormat { |
47 // Do not allow instantiation. | 47 // Do not allow instantiation. |
48 private WireFormat() {} | 48 private WireFormat() {} |
49 | 49 |
| 50 static final int FIXED_32_SIZE = 4; |
| 51 static final int FIXED_64_SIZE = 8; |
| 52 static final int MAX_VARINT_SIZE = 10; |
| 53 |
50 public static final int WIRETYPE_VARINT = 0; | 54 public static final int WIRETYPE_VARINT = 0; |
51 public static final int WIRETYPE_FIXED64 = 1; | 55 public static final int WIRETYPE_FIXED64 = 1; |
52 public static final int WIRETYPE_LENGTH_DELIMITED = 2; | 56 public static final int WIRETYPE_LENGTH_DELIMITED = 2; |
53 public static final int WIRETYPE_START_GROUP = 3; | 57 public static final int WIRETYPE_START_GROUP = 3; |
54 public static final int WIRETYPE_END_GROUP = 4; | 58 public static final int WIRETYPE_END_GROUP = 4; |
55 public static final int WIRETYPE_FIXED32 = 5; | 59 public static final int WIRETYPE_FIXED32 = 5; |
56 | 60 |
57 static final int TAG_TYPE_BITS = 3; | 61 static final int TAG_TYPE_BITS = 3; |
58 static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1; | 62 static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1; |
59 | 63 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // We don't handle enums because we don't know what to do if the | 251 // We don't handle enums because we don't know what to do if the |
248 // value is not recognized. | 252 // value is not recognized. |
249 throw new IllegalArgumentException( | 253 throw new IllegalArgumentException( |
250 "readPrimitiveField() cannot handle enums."); | 254 "readPrimitiveField() cannot handle enums."); |
251 } | 255 } |
252 | 256 |
253 throw new RuntimeException( | 257 throw new RuntimeException( |
254 "There is no way to get here, but the compiler thinks otherwise."); | 258 "There is no way to get here, but the compiler thinks otherwise."); |
255 } | 259 } |
256 } | 260 } |
OLD | NEW |