GTMGatherInputStream.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright 2014 Google Inc. All rights reserved.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. // The GTMGatherInput stream is an input stream implementation that is to be
  16. // instantiated with an NSArray of NSData objects. It works in the traditional
  17. // scatter/gather vector I/O model. Rather than allocating a big NSData object
  18. // to hold all of the data and performing a copy into that object, the
  19. // GTMGatherInputStream will maintain a reference to the NSArray and read from
  20. // each NSData in turn as the read method is called. You should not alter the
  21. // underlying set of NSData objects until all read operations on this input
  22. // stream have completed.
  23. #import <Foundation/Foundation.h>
  24. #ifndef GTM_NONNULL
  25. #if defined(__has_attribute)
  26. #if __has_attribute(nonnull)
  27. #define GTM_NONNULL(x) __attribute__((nonnull x))
  28. #else
  29. #define GTM_NONNULL(x)
  30. #endif
  31. #else
  32. #define GTM_NONNULL(x)
  33. #endif
  34. #endif
  35. // Avoid multiple declaration of this class.
  36. //
  37. // Note: This should match the declaration of GTMGatherInputStream in GTMMIMEDocument.m
  38. #ifndef GTM_GATHERINPUTSTREAM_DECLARED
  39. #define GTM_GATHERINPUTSTREAM_DECLARED
  40. @interface GTMGatherInputStream : NSInputStream <NSStreamDelegate>
  41. + (NSInputStream *)streamWithArray:(NSArray *)dataArray GTM_NONNULL((1));
  42. @end
  43. #endif // GTM_GATHERINPUTSTREAM_DECLARED