Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / support / lt_ioMemStream.h @ 3539

History | View | Annotate | Download (2.33 KB)

1
/* $Id: lt_ioMemStream.h 3539 2006-01-09 12:23:20Z nacho $ */
2
/* //////////////////////////////////////////////////////////////////////////
3
//                                                                         //
4
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue,   //
5
// Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
6
// prohibited.  Access to and use of this code is permitted only under     //
7
// license from LizardTech, Inc.  Portions of the code are protected by    //
8
// US and foreign patents and other filings. All Rights Reserved.          //
9
//                                                                         //
10
////////////////////////////////////////////////////////////////////////// */
11
/* PUBLIC */
12

    
13

    
14
#ifndef LT_IO_MEM_STREAM_H
15
#define LT_IO_MEM_STREAM_H
16

    
17
#include "lt_ioStreamInf.h"
18

    
19
LT_BEGIN_NAMESPACE( LizardTech )
20

    
21

    
22
/**
23
 * Stream which wraps an array of bytes in memory.
24
 *
25
 * The buffer is of a fixed size and does not grow or shrink.
26
 */
27
class LTIOMemStream : public LTIOStreamInf
28
{
29
public:
30
   LTIOMemStream();
31
   virtual ~LTIOMemStream();
32

    
33
   /** 
34
    * @name Initialization functions
35
    */
36
   /*@{*/
37
   /**
38
    * Initializes the stream
39
    *
40
    * @param   data  pointer to start of buffer
41
    * @param   size  size of buffer in bytes
42
    */
43
   virtual LT_STATUS initialize( void* data, lt_uint32 size );
44

    
45
   /**
46
    * Initializes the stream
47
    *
48
    * This version internally allocates a buffer of the specified size.
49
    * 
50
    * @param   size  size of buffer in bytes
51
    */
52
   virtual LT_STATUS initialize( lt_uint32 size );
53
   /*@}*/
54

    
55
        virtual bool isEOF();
56
        virtual bool isOpen();
57
        virtual LT_STATUS open();
58
        virtual LT_STATUS close();
59
   virtual lt_uint32 read( lt_uint8 *pDest, lt_uint32 numBytes );
60
   virtual lt_uint32 write( const lt_uint8 *pSrc, lt_uint32 numBytes );
61
   virtual LT_STATUS seek( lt_int64 offset, LTIOSeekDir origin );
62
   virtual lt_int64 tell();
63
        virtual LTIOStreamInf* duplicate();
64
        virtual LT_STATUS getLastError() const;
65
        virtual const char* getID() const;
66

    
67
protected:
68

    
69
   /**   pointer to buffer */
70
   lt_uint8*   m_data;
71

    
72
   /**   size of buffer */
73
   lt_uint32   m_size;
74

    
75
   /**   current position  */
76
   lt_uint32   m_cur;
77

    
78
   /**   data ownership */
79
   bool        m_ownsData;
80

    
81
   /**   openness */
82
   bool        m_isOpen;
83

    
84
   bool m_isEOF;
85
};
86

    
87

    
88
LT_END_NAMESPACE( LizardTech )
89

    
90

    
91
#endif        // LT_IO_MEM_STREAM_H