File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 46
46
47
47
NS_ASSUME_NONNULL_BEGIN
48
48
49
+ /* *
50
+ * @c GPBCodedOutputStream exception names.
51
+ **/
52
+ extern NSString *const GPBCodedOutputStreamException_OutOfSpace;
53
+ extern NSString *const GPBCodedOutputStreamException_WriteFailed;
54
+
49
55
/* *
50
56
* Writes out protocol message fields.
51
57
*
52
58
* The common uses of protocol buffers shouldn't need to use this class.
53
59
* GPBMessage's provide a -data method that will serialize the message for you.
54
60
*
61
+ * @note Any -write* api can raise the GPBCodedOutputStreamException_*
62
+ * exceptions.
63
+ *
55
64
* @note Subclassing of GPBCodedOutputStream is NOT supported.
56
65
**/
57
66
@interface GPBCodedOutputStream : NSObject
Original file line number Diff line number Diff line change 36
36
#import " GPBUnknownFieldSet_PackagePrivate.h"
37
37
#import " GPBUtilities_PackagePrivate.h"
38
38
39
+ // These values are the existing values so as not to break any code that might
40
+ // have already been inspecting them when they weren't documented/exposed.
41
+ NSString *const GPBCodedOutputStreamException_OutOfSpace = @" OutOfSpace" ;
42
+ NSString *const GPBCodedOutputStreamException_WriteFailed = @" WriteFailed" ;
43
+
39
44
// Structure for containing state of a GPBCodedInputStream. Brought out into
40
45
// a struct so that we can inline several common functions instead of dealing
41
46
// with overhead of ObjC dispatch.
@@ -59,13 +64,13 @@ @implementation GPBCodedOutputStream {
59
64
static void GPBRefreshBuffer (GPBOutputBufferState *state) {
60
65
if (state->output == nil ) {
61
66
// We're writing to a single buffer.
62
- [NSException raise: @" OutOfSpace " format: @" " ];
67
+ [NSException raise: GPBCodedOutputStreamException_OutOfSpace format: @" " ];
63
68
}
64
69
if (state->position != 0 ) {
65
70
NSInteger written =
66
71
[state->output write: state->bytes maxLength: state->position];
67
72
if (written != (NSInteger )state->position ) {
68
- [NSException raise: @" WriteFailed " format: @" " ];
73
+ [NSException raise: GPBCodedOutputStreamException_WriteFailed format: @" " ];
69
74
}
70
75
state->position = 0 ;
71
76
}
Original file line number Diff line number Diff line change @@ -292,13 +292,18 @@ CF_EXTERN_C_END
292
292
* Writes out the message to the given coded output stream.
293
293
*
294
294
* @param output The coded output stream into which to write the message.
295
+ *
296
+ * @note This can raise the GPBCodedOutputStreamException_* exceptions.
297
+ *
295
298
**/
296
299
- (void )writeToCodedOutputStream : (GPBCodedOutputStream *)output ;
297
300
298
301
/* *
299
302
* Writes out the message to the given output stream.
300
303
*
301
304
* @param output The output stream into which to write the message.
305
+ *
306
+ * @note This can raise the GPBCodedOutputStreamException_* exceptions.
302
307
**/
303
308
- (void )writeToOutputStream : (NSOutputStream *)output ;
304
309
@@ -307,6 +312,8 @@ CF_EXTERN_C_END
307
312
* the given output stream.
308
313
*
309
314
* @param output The coded output stream into which to write the message.
315
+ *
316
+ * @note This can raise the GPBCodedOutputStreamException_* exceptions.
310
317
**/
311
318
- (void )writeDelimitedToCodedOutputStream : (GPBCodedOutputStream *)output ;
312
319
@@ -315,6 +322,8 @@ CF_EXTERN_C_END
315
322
* the given output stream.
316
323
*
317
324
* @param output The output stream into which to write the message.
325
+ *
326
+ * @note This can raise the GPBCodedOutputStreamException_* exceptions.
318
327
**/
319
328
- (void )writeDelimitedToOutputStream : (NSOutputStream *)output ;
320
329
You can’t perform that action at this time.
0 commit comments