2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGStreams_NGDataStream_H__
24 #define __NGStreams_NGDataStream_H__
26 #include <NGStreams/NGStream.h>
27 #include <NGStreams/NGStreamProtocols.h>
31 @interface NGDataStream : NGStream < NGPositionableStream >
34 NSException *lastException;
35 NGStreamMode streamMode;
39 unsigned int (*dataLength)(id, SEL);
40 const void *(*dataBytes)(id, SEL);
42 /* for read-only streams */
48 + (id)dataStreamWithCapacity:(int)_capacity;
49 + (id)streamWithData:(NSData *)_data;
50 - (id)initWithData:(NSData *)_data mode:(NGStreamMode)_mode;
51 - (id)initWithData:(NSData *)_data;
53 - (NSException *)lastException;
54 - (void)setLastException:(NSException *)_exception;
55 - (void)resetLastException;
61 - (unsigned)availableBytes; // returns number of available bytes
66 // NGStreamNotOpenException when the stream is not open
67 // NGEndOfStreamException when the end of the stream is reached
68 - (unsigned)readBytes:(void *)_buf count:(unsigned)_len;
71 // NGReadOnlyStreamException when the stream is not writeable
72 // NGStreamNotOpenException when the stream is not open
73 - (unsigned)writeBytes:(const void *)_buf count:(unsigned)_len;
80 // NGPositionableStream
82 - (BOOL)moveToLocation:(unsigned)_location;
83 - (BOOL)moveByOffset:(int)_delta;
87 - (BOOL)wouldBlockInMode:(NGStreamMode)_mode; // always NO ..
91 #endif /* __NGStreams_NGDataStream_H__ */