activemq-cpp-3.9.5
DataInputStream.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_DATAINPUTSTREAM_H_
19#define _DECAF_IO_DATAINPUTSTREAM_H_
20
27
28namespace decaf{
29namespace io{
30
46 class DECAF_API DataInputStream: public FilterInputStream {
47 private:
48
49 // Buffer used to store bytes read from the stream while reconstructed into
50 // higher order C++ primitives.
51 unsigned char buffer[8];
52
53 private:
54
55 DataInputStream(const DataInputStream&);
56 DataInputStream& operator=(const DataInputStream&);
57
58 public:
59
68
70
71 public:
72 // DataInput
73
83 virtual bool readBoolean();
84
94 virtual char readByte();
95
105 virtual unsigned char readUnsignedByte();
106
117 virtual char readChar();
118
130 virtual double readDouble();
131
143 virtual float readFloat();
144
158 virtual int readInt();
159
181 virtual long long readLong();
182
194 virtual short readShort();
195
208 virtual unsigned short readUnsignedShort();
209
219 virtual std::string readString();
220
240 virtual std::string readLine();
241
257 virtual std::string readUTF();
258
287 virtual void readFully(unsigned char* buffer, int size);
288
320 virtual void readFully(unsigned char* buffer, int size, int offset, int length);
321
337 virtual long long skipBytes(long long num);
338
339 private:
340
341 // Used internally to reliably get data from the underlying stream
342 void readAllData(unsigned char* buffer, int length);
343
344 };
345
346}}
347
348#endif /*_DECAF_IO_DATAINPUTSTREAM_H_*/
virtual long long skipBytes(long long num)
Makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes.
virtual long long readLong()
Reads eight input bytes and returns a long value.
virtual void readFully(unsigned char *buffer, int size)
Reads some bytes from an input stream and stores them into the buffer array buffer.
virtual void readFully(unsigned char *buffer, int size, int offset, int length)
Reads length bytes from an input stream.
virtual char readByte()
Reads and returns one input byte.
virtual unsigned char readUnsignedByte()
Reads one input byte, zero-extends it to type int, and returns the result, which is therefore in the ...
virtual std::string readUTF()
Reads a modified UTF-8 encoded string in ASCII format and returns it, this is only useful if you know...
virtual short readShort()
Reads two input bytes and returns a short value.
DataInputStream(InputStream *inputStream, bool own=false)
Creates a DataInputStream that uses the specified underlying InputStream.
virtual std::string readLine()
Reads the next line of text from the input stream.
virtual float readFloat()
Reads four input bytes and returns a float value.
virtual int readInt()
Reads four input bytes and returns an int value.
virtual double readDouble()
Reads eight input bytes and returns a double value.
virtual char readChar()
Reads an input char and returns the char value.
virtual bool readBoolean()
Reads in one byte and returns true if that byte is nonzero, false if that byte is zero.
virtual unsigned short readUnsignedShort()
Reads two input bytes and returns an int value in the range 0 through 65535.
virtual std::string readString()
Reads an NULL terminated ASCII string to the stream and returns the string to the caller.
bool own
Definition FilterInputStream.h:45
InputStream * inputStream
Definition FilterInputStream.h:42
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