activemq-cpp-3.9.5
BufferedInputStream.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_IO_BUFFEREDINPUTSTREAM_H_
19#define _DECAF_IO_BUFFEREDINPUTSTREAM_H_
20
21#include <decaf/util/Config.h>
24
25namespace decaf{
26namespace io{
27
34 class DECAF_API BufferedInputStream : public FilterInputStream {
35 private:
36
37 int pos;
38 int count;
39 int markLimit;
40 int markPos;
41 int bufferSize;
42 unsigned char* buff;
43
44 // Proxy to the actual buffer, when NULL it signals this stream is closed.
45 // the actual buffer is deleted in the destructor.
46 unsigned char* proxyBuffer;
47
48 private:
49
50 BufferedInputStream(const BufferedInputStream&);
51 BufferedInputStream& operator=(const BufferedInputStream&);
52
53 public:
54
63 BufferedInputStream(InputStream* stream, bool own = false);
64
77 BufferedInputStream(InputStream* stream, int bufferSize, bool own = false);
78
80
84 virtual int available() const;
85
89 virtual void close();
90
94 virtual long long skip(long long num);
95
99 virtual void mark(int readLimit);
100
104 virtual void reset();
105
109 virtual bool markSupported() const {
110 return true;
111 }
112
113 protected:
114
115 virtual int doReadByte();
116
117 virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
118
119 private:
120
121 int bufferData(InputStream* stream, unsigned char*& buffer);
122
123 };
124
125}}
126
127#endif /*_DECAF_IO_BUFFEREDINPUTSTREAM_H_*/
virtual int doReadArrayBounded(unsigned char *buffer, int size, int offset, int length)
virtual void close()
Closes the InputStream freeing any resources that might have been acquired during the lifetime of thi...
BufferedInputStream(InputStream *stream, int bufferSize, bool own=false)
Constructor.
virtual long long skip(long long num)
Skips over and discards n bytes of data from this input stream.The skip method may,...
virtual bool markSupported() const
Determines if this input stream supports the mark and reset methods.Whether or not mark and reset are...
Definition BufferedInputStream.h:109
BufferedInputStream(InputStream *stream, bool own=false)
Constructor.
virtual void mark(int readLimit)
Marks the current position in the stream A subsequent call to the reset method repositions this strea...
virtual void reset()
Repositions this stream to the position at the time the mark method was last called on this input str...
virtual int available() const
Indicates the number of bytes available.The default implementation of this methods returns 0....
bool own
Definition FilterInputStream.h:45
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition InputStream.h:39
#define DECAF_API
Definition Config.h:29
Definition BlockingByteArrayInputStream.h:25
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25