| 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 | |
| 54 public static final int WIRETYPE_VARINT = 0; | 50 public static final int WIRETYPE_VARINT = 0; |
| 55 public static final int WIRETYPE_FIXED64 = 1; | 51 public static final int WIRETYPE_FIXED64 = 1; |
| 56 public static final int WIRETYPE_LENGTH_DELIMITED = 2; | 52 public static final int WIRETYPE_LENGTH_DELIMITED = 2; |
| 57 public static final int WIRETYPE_START_GROUP = 3; | 53 public static final int WIRETYPE_START_GROUP = 3; |
| 58 public static final int WIRETYPE_END_GROUP = 4; | 54 public static final int WIRETYPE_END_GROUP = 4; |
| 59 public static final int WIRETYPE_FIXED32 = 5; | 55 public static final int WIRETYPE_FIXED32 = 5; |
| 60 | 56 |
| 61 static final int TAG_TYPE_BITS = 3; | 57 static final int TAG_TYPE_BITS = 3; |
| 62 static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1; | 58 static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1; |
| 63 | 59 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // We don't handle enums because we don't know what to do if the | 247 // We don't handle enums because we don't know what to do if the |
| 252 // value is not recognized. | 248 // value is not recognized. |
| 253 throw new IllegalArgumentException( | 249 throw new IllegalArgumentException( |
| 254 "readPrimitiveField() cannot handle enums."); | 250 "readPrimitiveField() cannot handle enums."); |
| 255 } | 251 } |
| 256 | 252 |
| 257 throw new RuntimeException( | 253 throw new RuntimeException( |
| 258 "There is no way to get here, but the compiler thinks otherwise."); | 254 "There is no way to get here, but the compiler thinks otherwise."); |
| 259 } | 255 } |
| 260 } | 256 } |
| OLD | NEW |