| OLD | NEW |
| 1 #region Copyright notice and license | 1 #region Copyright notice and license |
| 2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
| 3 // Copyright 2015 Google Inc. All rights reserved. | 3 // Copyright 2015 Google Inc. All rights reserved. |
| 4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
| 5 // | 5 // |
| 6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
| 7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
| 8 // met: | 8 // met: |
| 9 // | 9 // |
| 10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return factory(); | 57 return factory(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 /// <summary> | 60 /// <summary> |
| 61 /// Parses a message from a byte array. | 61 /// Parses a message from a byte array. |
| 62 /// </summary> | 62 /// </summary> |
| 63 /// <param name="data">The byte array containing the message. Must not b
e null.</param> | 63 /// <param name="data">The byte array containing the message. Must not b
e null.</param> |
| 64 /// <returns>The newly parsed message.</returns> | 64 /// <returns>The newly parsed message.</returns> |
| 65 public IMessage ParseFrom(byte[] data) | 65 public IMessage ParseFrom(byte[] data) |
| 66 { | 66 { |
| 67 Preconditions.CheckNotNull(data, "data"); | 67 ProtoPreconditions.CheckNotNull(data, "data"); |
| 68 IMessage message = factory(); | 68 IMessage message = factory(); |
| 69 message.MergeFrom(data); | 69 message.MergeFrom(data); |
| 70 return message; | 70 return message; |
| 71 } | 71 } |
| 72 | 72 |
| 73 /// <summary> | 73 /// <summary> |
| 74 /// Parses a message from the given byte string. | 74 /// Parses a message from the given byte string. |
| 75 /// </summary> | 75 /// </summary> |
| 76 /// <param name="data">The data to parse.</param> | 76 /// <param name="data">The data to parse.</param> |
| 77 /// <returns>The parsed message.</returns> | 77 /// <returns>The parsed message.</returns> |
| 78 public IMessage ParseFrom(ByteString data) | 78 public IMessage ParseFrom(ByteString data) |
| 79 { | 79 { |
| 80 Preconditions.CheckNotNull(data, "data"); | 80 ProtoPreconditions.CheckNotNull(data, "data"); |
| 81 IMessage message = factory(); | 81 IMessage message = factory(); |
| 82 message.MergeFrom(data); | 82 message.MergeFrom(data); |
| 83 return message; | 83 return message; |
| 84 } | 84 } |
| 85 | 85 |
| 86 /// <summary> | 86 /// <summary> |
| 87 /// Parses a message from the given stream. | 87 /// Parses a message from the given stream. |
| 88 /// </summary> | 88 /// </summary> |
| 89 /// <param name="input">The stream to parse.</param> | 89 /// <param name="input">The stream to parse.</param> |
| 90 /// <returns>The parsed message.</returns> | 90 /// <returns>The parsed message.</returns> |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return factory(); | 184 return factory(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 /// <summary> | 187 /// <summary> |
| 188 /// Parses a message from a byte array. | 188 /// Parses a message from a byte array. |
| 189 /// </summary> | 189 /// </summary> |
| 190 /// <param name="data">The byte array containing the message. Must not b
e null.</param> | 190 /// <param name="data">The byte array containing the message. Must not b
e null.</param> |
| 191 /// <returns>The newly parsed message.</returns> | 191 /// <returns>The newly parsed message.</returns> |
| 192 public new T ParseFrom(byte[] data) | 192 public new T ParseFrom(byte[] data) |
| 193 { | 193 { |
| 194 Preconditions.CheckNotNull(data, "data"); | 194 ProtoPreconditions.CheckNotNull(data, "data"); |
| 195 T message = factory(); | 195 T message = factory(); |
| 196 message.MergeFrom(data); | 196 message.MergeFrom(data); |
| 197 return message; | 197 return message; |
| 198 } | 198 } |
| 199 | 199 |
| 200 /// <summary> | 200 /// <summary> |
| 201 /// Parses a message from the given byte string. | 201 /// Parses a message from the given byte string. |
| 202 /// </summary> | 202 /// </summary> |
| 203 /// <param name="data">The data to parse.</param> | 203 /// <param name="data">The data to parse.</param> |
| 204 /// <returns>The parsed message.</returns> | 204 /// <returns>The parsed message.</returns> |
| 205 public new T ParseFrom(ByteString data) | 205 public new T ParseFrom(ByteString data) |
| 206 { | 206 { |
| 207 Preconditions.CheckNotNull(data, "data"); | 207 ProtoPreconditions.CheckNotNull(data, "data"); |
| 208 T message = factory(); | 208 T message = factory(); |
| 209 message.MergeFrom(data); | 209 message.MergeFrom(data); |
| 210 return message; | 210 return message; |
| 211 } | 211 } |
| 212 | 212 |
| 213 /// <summary> | 213 /// <summary> |
| 214 /// Parses a message from the given stream. | 214 /// Parses a message from the given stream. |
| 215 /// </summary> | 215 /// </summary> |
| 216 /// <param name="input">The stream to parse.</param> | 216 /// <param name="input">The stream to parse.</param> |
| 217 /// <returns>The parsed message.</returns> | 217 /// <returns>The parsed message.</returns> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 /// <exception cref="InvalidJsonException">The JSON does not comply with
RFC 7159</exception> | 258 /// <exception cref="InvalidJsonException">The JSON does not comply with
RFC 7159</exception> |
| 259 /// <exception cref="InvalidProtocolBufferException">The JSON does not r
epresent a Protocol Buffers message correctly</exception> | 259 /// <exception cref="InvalidProtocolBufferException">The JSON does not r
epresent a Protocol Buffers message correctly</exception> |
| 260 public new T ParseJson(string json) | 260 public new T ParseJson(string json) |
| 261 { | 261 { |
| 262 T message = factory(); | 262 T message = factory(); |
| 263 JsonParser.Default.Merge(message, json); | 263 JsonParser.Default.Merge(message, json); |
| 264 return message; | 264 return message; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 } | 267 } |
| OLD | NEW |