activemq-cpp-3.4.0

src/main/decaf/io/DataInputStream.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _DECAF_IO_DATAINPUTSTREAM_H_
00019 #define _DECAF_IO_DATAINPUTSTREAM_H_
00020 
00021 #include <decaf/io/FilterInputStream.h>
00022 #include <decaf/io/IOException.h>
00023 #include <decaf/io/EOFException.h>
00024 #include <decaf/io/UTFDataFormatException.h>
00025 #include <decaf/lang/exceptions/NullPointerException.h>
00026 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
00027 
00028 namespace decaf{
00029 namespace io{
00030 
00046     class DECAF_API DataInputStream : public FilterInputStream {
00047     private:
00048 
00049         // Buffer used to store bytes read from the stream while reconstructed into
00050         // higher order C++ primitives.
00051         unsigned char buffer[8];
00052 
00053     private:
00054 
00055         DataInputStream( const DataInputStream& );
00056         DataInputStream& operator= ( const DataInputStream& );
00057 
00058     public:
00059 
00067         DataInputStream( InputStream* inputStream, bool own = false );
00068 
00069         virtual ~DataInputStream();
00070 
00071     public:  // DataInput
00072 
00082         virtual bool readBoolean();
00083 
00093         virtual char readByte();
00094 
00104         virtual unsigned char readUnsignedByte();
00105 
00116         virtual char readChar();
00117 
00129         virtual double readDouble();
00130 
00142         virtual float readFloat();
00143 
00157         virtual int readInt();
00158 
00180         virtual long long readLong();
00181 
00193         virtual short readShort();
00194 
00207         virtual unsigned short readUnsignedShort();
00208 
00218         virtual std::string readString();
00219 
00239         virtual std::string readLine();
00240 
00256         virtual std::string readUTF();
00257 
00286         virtual void readFully( unsigned char* buffer, int size );
00287 
00319         virtual void readFully( unsigned char* buffer, int size, int offset, int length );
00320 
00336         virtual long long skipBytes( long long num );
00337 
00338     private:
00339 
00340         // Used internally to reliably get data from the underlying stream
00341         void readAllData( unsigned char* buffer, int length );
00342 
00343     };
00344 
00345 }}
00346 
00347 #endif /*_DECAF_IO_DATAINPUTSTREAM_H_*/