Author: tabish
Date: Sat Nov 3 13:54:02 2007
New Revision: 591683
URL: http://svn.apache.org/viewvc?rev=591683&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103
http://issues.apache.org/activemq/browse/AMQCPP-136
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.h
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.cpp?rev=591683&r1=591682&r2=591683&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.cpp
(original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.cpp Sat
Nov 3 13:54:02 2007
@@ -46,16 +46,26 @@
int DataInputStream::read( unsigned char* buffer,
std::size_t offset,
std::size_t length )
- throw ( IOException, IndexOutOfBoundsException, NullPointerException ) {
+ throw ( IOException, NullPointerException ) {
try {
+ if( length == 0 ) {
+ return 0;
+ }
+
if( buffer == NULL ) {
throw NullPointerException(
__FILE__, __LINE__,
"DataInputStream::read - Buffer is null" );
}
+ if( inputStream == NULL ) {
+ throw NullPointerException(
+ __FILE__, __LINE__,
+ "DataInputStream::readFully - Base input stream is null" );
+ }
+
return inputStream->read( &buffer[offset], length );
}
DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
@@ -221,6 +231,13 @@
std::string DataInputStream::readString()
throw ( io::IOException, io::EOFException ) {
try {
+
+ if( inputStream == NULL ) {
+ throw IOException(
+ __FILE__, __LINE__,
+ "DataInputStream::readFully - Base input stream is null" );
+ }
+
size_t size = 1024;
std::vector<char> buffer;
buffer.resize( size );
@@ -256,6 +273,13 @@
std::string DataInputStream::readUTF()
throw ( io::IOException, io::EOFException ) {
try {
+
+ if( inputStream == NULL ) {
+ throw IOException(
+ __FILE__, __LINE__,
+ "DataInputStream::readFully - Base input stream is null" );
+ }
+
std::vector<unsigned char> buffer;
unsigned short length = readUnsignedShort();
buffer.resize(length + 1); // Add one for a null charactor.
@@ -298,17 +322,26 @@
std::size_t length )
throw ( io::IOException,
io::EOFException,
- lang::exceptions::IndexOutOfBoundsException,
lang::exceptions::NullPointerException )
{
try {
+ if( length == 0 ) {
+ return;
+ }
+
if( buffer == NULL ) {
throw NullPointerException(
__FILE__, __LINE__,
"DataInputStream::readFully - Buffer is null" );
}
+ if( inputStream == NULL ) {
+ throw NullPointerException(
+ __FILE__, __LINE__,
+ "DataInputStream::readFully - Base input stream is null" );
+ }
+
std::size_t n = 0;
while( n < length ) {
int count = inputStream->read( &buffer[offset + n], (length - n) );
@@ -320,7 +353,6 @@
n += count;
}
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCH_RETHROW( EOFException )
DECAF_CATCH_RETHROW( IOException )
@@ -331,6 +363,13 @@
std::size_t DataInputStream::skip( std::size_t num )
throw( io::IOException, lang::exceptions::UnsupportedOperationException ) {
try {
+
+ if( inputStream == NULL ) {
+ throw IOException(
+ __FILE__, __LINE__,
+ "DataInputStream::readFully - Base input stream is null" );
+ }
+
std::size_t total = 0;
std::size_t cur = 0;
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.h?rev=591683&r1=591682&r2=591683&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.h
(original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/DataInputStream.h Sat
Nov 3 13:54:02 2007
@@ -129,12 +129,12 @@
* @returns the total number of bytes read, or -1 if there is no
* more data because the stream is EOF.
* @throws IOException
+ * @throws NullPointerException if the buffer is null
*/
virtual int read( unsigned char* buffer,
std::size_t offset,
std::size_t length )
throw ( io::IOException,
- lang::exceptions::IndexOutOfBoundsException,
lang::exceptions::NullPointerException );
/**
@@ -323,13 +323,13 @@
* @param length - number of bytes to read
* @throws IOException
* @throws EOFException
+ * @throws NullPointerException if the buffer is null
*/
virtual void readFully( unsigned char* buffer,
std::size_t offset,
std::size_t length )
throw ( io::IOException,
io::EOFException,
- lang::exceptions::IndexOutOfBoundsException,
lang::exceptions::NullPointerException );
/**
Modified:
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp?rev=591683&r1=591682&r2=591683&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp
(original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp
Sat Nov 3 13:54:02 2007
@@ -17,12 +17,333 @@
#include "DataInputStreamTest.h"
+#include <decaf/lang/Integer.h>
+
using namespace std;
using namespace decaf;
using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
using namespace decaf::io;
using namespace decaf::util;
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::testConstructor() {
+
+ try {
+
+ os->writeChar('t');
+ os->close();
+ openDataInputStream();
+ } catch (IOException e) {
+ CPPUNIT_FAIL("IOException during constructor test : " +
e.getMessage());
+ }
+
+ try {
+ is->close();
+ } catch (IOException e) {
+ CPPUNIT_FAIL("IOException during constructor test : " +
e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::testRead1() {
+
+ try {
+
+ std::vector<unsigned char> test( testData.begin(), testData.end() );
+ os->write( test );
+ os->close();
+ openDataInputStream();
+ std::vector<unsigned char> result;
+ result.resize( testData.length() );
+ is->read( result );
+ CPPUNIT_ASSERT_MESSAGE( "Incorrect data read",
+ string( (const char*)&result[0], result.size() ) == testData );
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during read test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::testRead2() {
+ try {
+
+ os->write( std::vector<unsigned char>( testData.begin(),
testData.end() ) );
+ os->close();
+ openDataInputStream();
+ unsigned char* result = new unsigned char[ testData.length() ];
+ is->read( result, 0, testData.length() );
+ CPPUNIT_ASSERT_MESSAGE("Incorrect data read",
+ string( (const char*)result, testData.size() ) == testData );
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during read test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readBoolean() {
+
+ try {
+ os->writeBoolean(true);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect boolean written", is->readBoolean()
);
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("readBoolean test failed : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readByte() {
+ try {
+ os->writeByte( (unsigned char) 127);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect byte read", is->readByte() ==
(unsigned char) 127);
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readByte test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readChar() {
+ try {
+ os->writeChar('t');
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect char read", 't' == is->readChar());
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readChar test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readDouble() {
+ try {
+ os->writeDouble(2345.76834720202);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect double read",
+ 2345.76834720202 == is->readDouble());
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readDouble test" + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readFloat() {
+ try {
+ os->writeFloat(29.08764f);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect float read", is->readFloat() ==
29.08764f);
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("readFloat test failed : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readFully1() {
+ try {
+ os->write( std::vector<unsigned char>( testData.begin(),
testData.end() ) );
+ os->close();
+ openDataInputStream();
+ std::vector<unsigned char> result;
+ result.resize( testData.length() );
+ is->readFully( result );
+ CPPUNIT_ASSERT_MESSAGE( "Incorrect data read",
+ string( (const char*)&result[0], 0, result.size() ) == testData );
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readFully2() {
+
+ try {
+ os->write( std::vector<unsigned char>( testData.begin(),
testData.end() ) );
+ os->close();
+ openDataInputStream();
+ unsigned char* rbytes = new unsigned char[ testData.length() ];
+ is->readFully( rbytes, 0, testData.length() );
+ CPPUNIT_ASSERT_MESSAGE("Incorrect data read",
+ string( (const char*)rbytes, 0, testData.length() ) == testData );
+ delete rbytes;
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readFullyNullArray() {
+ std::vector<unsigned char> test( 5000 );
+ DataInputStream is(
+ new ByteArrayInputStream( test ), true );
+
+ unsigned char* nullByteArray = NULL;
+
+ is.readFully( nullByteArray, 0, 0);
+ is.readFully( nullByteArray, 1, 0);
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( nullByteArray, 0, 1),
+ NullPointerException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( nullByteArray, 1, 1),
+ NullPointerException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( nullByteArray, 1, Integer::MAX_VALUE),
+ NullPointerException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readFullyNullStream() {
+
+ DataInputStream is(NULL);
+ unsigned char* byteArray = new unsigned char[testData.length()];
+
+ is.readFully( byteArray, 0, 0 );
+ is.readFully( byteArray, 1, 0 );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( byteArray, 1, 1 ),
+ NullPointerException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( byteArray, 0, 1 ),
+ NullPointerException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( byteArray, 0, Integer::MAX_VALUE ),
+ NullPointerException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readFullyNullStreamNullArray() {
+
+ DataInputStream is(NULL);
+ unsigned char* nullByteArray = NULL;
+
+ is.readFully( nullByteArray, 0, 0 );
+ is.readFully( nullByteArray, 1, 0 );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( nullByteArray, 0, 1),
+ NullPointerException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( nullByteArray, 1, 1),
+ NullPointerException );
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "should throw NullPointerException",
+ is.readFully( nullByteArray, 1, Integer::MAX_VALUE),
+ NullPointerException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readInt() {
+ try {
+ os->writeInt(768347202);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect int read", 768347202 ==
is->readInt());
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readInt test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readLong() {
+ try {
+ os->writeLong(9875645283333LL);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect long read", 9875645283333LL ==
is->readLong());
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("read long test failed : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readShort() {
+ try {
+ os->writeShort(9875);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect short read", is->readShort() ==
(short) 9875);
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("Exception during read short test : " + e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readUnsignedByte() {
+ try {
+ os->writeByte((unsigned char) -127);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect byte read", 129 ==
is->readUnsignedByte());
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during readUnsignedByte test : " +
e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_readUnsignedShort() {
+ os->writeShort(9875);
+ os->close();
+ openDataInputStream();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect short read", 9875 ==
is->readUnsignedShort());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamTest::test_skipBytes() {
+ try {
+ os->write( std::vector<unsigned char>( testData.begin(),
testData.end() ) );
+ os->close();
+ openDataInputStream();
+ is->skip( 100 );
+ std::vector<unsigned char> result( 50 );
+ is->read( result );
+ is->close();
+ CPPUNIT_ASSERT_MESSAGE("Incorrect data read",
+ string( (const char*)&result[0], 50) == testData.substr( 100, 50)
);
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during skipBytes test 1 : " +
e.getMessage());
+ }
+ try {
+
+ std::size_t skipped = 0;
+ openDataInputStream();
+
+ CPPUNIT_ASSERT_NO_THROW_MESSAGE(
+ "Should throw an EOFException",
+ skipped = is->skip( 500000 ) );
+
+ CPPUNIT_ASSERT_MESSAGE(
+ "Skipped should report " +
+ Integer::toString( testData.length() ) + " not " +
+ Integer::toString( skipped ),
+ skipped == testData.length() );
+
+ } catch( IOException &e ) {
+ CPPUNIT_FAIL("IOException during skipBytes test 2 : " +
e.getMessage());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
void DataInputStreamTest::test(){
unsigned char buffer[30];
@@ -108,6 +429,7 @@
CPPUNIT_ASSERT( arrayVal[2] == 'c' );
}
+////////////////////////////////////////////////////////////////////////////////
void DataInputStreamTest::testString() {
std::string data1 = "This is a Test";
@@ -147,6 +469,7 @@
}
}
+////////////////////////////////////////////////////////////////////////////////
void DataInputStreamTest::testUTF() {
std::string data1 = "This is a Test";
Modified:
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.h?rev=591683&r1=591682&r2=591683&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.h
(original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.h
Sat Nov 3 13:54:02 2007
@@ -23,14 +23,10 @@
#include <decaf/util/Endian.h>
#include <decaf/lang/Exception.h>
-#include <decaf/io/BufferedInputStream.h>
#include <decaf/io/ByteArrayInputStream.h>
+#include <decaf/io/ByteArrayOutputStream.h>
#include <decaf/io/DataInputStream.h>
-
-#ifdef min
-#undef min
-#endif
-
+#include <decaf/io/DataOutputStream.h>
#include <algorithm>
namespace decaf{
@@ -42,17 +38,83 @@
CPPUNIT_TEST( test );
CPPUNIT_TEST( testString );
CPPUNIT_TEST( testUTF );
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testRead1 );
+ CPPUNIT_TEST( testRead2 );
+ CPPUNIT_TEST( test_readBoolean );
+ CPPUNIT_TEST( test_readByte );
+ CPPUNIT_TEST( test_readChar );
+ CPPUNIT_TEST( test_readDouble );
+ CPPUNIT_TEST( test_readFloat );
+ CPPUNIT_TEST( test_readFully1 );
+ CPPUNIT_TEST( test_readFully2 );
+ CPPUNIT_TEST( test_readFullyNullArray );
+ CPPUNIT_TEST( test_readFullyNullStream );
+ CPPUNIT_TEST( test_readFullyNullStreamNullArray );
+ CPPUNIT_TEST( test_readInt );
+ CPPUNIT_TEST( test_readLong );
+ CPPUNIT_TEST( test_readShort );
+ CPPUNIT_TEST( test_readUnsignedByte );
+ CPPUNIT_TEST( test_readUnsignedShort );
+ CPPUNIT_TEST( test_skipBytes );
CPPUNIT_TEST_SUITE_END();
+ ByteArrayOutputStream* baos;
+ ByteArrayInputStream* bais;
+
+ DataOutputStream* os;
+ DataInputStream* is;
+
+ std::string testData;
+
public:
virtual ~DataInputStreamTest(){}
- virtual void setUp(){}
- virtual void tearDown(){}
+ virtual void setUp(){
+ testData =
"Test_All_Tests\nTest_decaf_io_BufferedInputStream\nTest_BufferedOutputStream\nTest_decaf_io_ByteArrayInputStream\nTest_decaf_io_ByteArrayOutputStream\nTest_decaf_io_DataInputStream\nTest_decaf_io_File\nTest_decaf_io_FileDescriptor\nTest_decaf_io_FileInputStream\nTest_decaf_io_FileNotFoundException\nTest_decaf_io_FileOutputStream\nTest_decaf_io_FilterInputStream\nTest_decaf_io_FilterOutputStream\nTest_decaf_io_InputStream\nTest_decaf_io_IOException\nTest_decaf_io_OutputStream\nTest_decaf_io_PrintStream\nTest_decaf_io_RandomAccessFile\nTest_decaf_io_SyncFailedException\nTest_decaf_lang_AbstractMethodError\nTest_decaf_lang_ArithmeticException\nTest_decaf_lang_ArrayIndexOutOfBoundsException\nTest_decaf_lang_ArrayStoreException\nTest_decaf_lang_Boolean\nTest_decaf_lang_Byte\nTest_decaf_lang_Character\nTest_decaf_lang_Class\nTest_decaf_lang_ClassCastException\nTest_decaf_lang_ClassCircularityError\nTest_decaf_lang_ClassFormatError\nTest_decaf_lang_ClassLoad
er\nTest_decaf_lang_ClassNotFoundException\nTest_decaf_lang_CloneNotSupportedException\nTest_decaf_lang_Double\nTest_decaf_lang_Error\nTest_decaf_lang_Exception\nTest_decaf_lang_ExceptionInInitializerError\nTest_decaf_lang_Float\nTest_decaf_lang_IllegalAccessError\nTest_decaf_lang_IllegalAccessException\nTest_decaf_lang_IllegalArgumentException\nTest_decaf_lang_IllegalMonitorStateException\nTest_decaf_lang_IllegalThreadStateException\nTest_decaf_lang_IncompatibleClassChangeError\nTest_decaf_lang_IndexOutOfBoundsException\nTest_decaf_lang_InstantiationError\nTest_decaf_lang_InstantiationException\nTest_decaf_lang_Integer\nTest_decaf_lang_InternalError\nTest_decaf_lang_InterruptedException\nTest_decaf_lang_LinkageError\nTest_decaf_lang_Long\nTest_decaf_lang_Math\nTest_decaf_lang_NegativeArraySizeException\nTest_decaf_lang_NoClassDefFoundError\nTest_decaf_lang_NoSuchFieldError\nTest_decaf_lang_NoSuchMethodError\nTest_decaf_lang_NullPointerException\nTest_decaf_lang_Number\nTest
_decaf_lang_NumberFormatException\nTest_decaf_lang_Object\nTest_decaf_lang_OutOfMemoryError\nTest_decaf_lang_RuntimeException\nTest_decaf_lang_SecurityManager\nTest_decaf_lang_Short\nTest_decaf_lang_StackOverflowError\nTest_decaf_lang_String\nTest_decaf_lang_StringBuffer\nTest_decaf_lang_StringIndexOutOfBoundsException\nTest_decaf_lang_System\nTest_decaf_lang_Thread\nTest_decaf_lang_ThreadDeath\nTest_decaf_lang_ThreadGroup\nTest_decaf_lang_Throwable\nTest_decaf_lang_UnknownError\nTest_decaf_lang_UnsatisfiedLinkError\nTest_decaf_lang_VerifyError\nTest_decaf_lang_VirtualMachineError\nTest_decaf_lang_vm_Image\nTest_decaf_lang_vm_MemorySegment\nTest_decaf_lang_vm_ROMStoreException\nTest_decaf_lang_vm_VM\nTest_decaf_lang_Void\nTest_decaf_net_BindException\nTest_decaf_net_ConnectException\nTest_decaf_net_DatagramPacket\nTest_decaf_net_DatagramSocket\nTest_decaf_net_DatagramSocketImpl\nTest_decaf_net_InetAddress\nTest_decaf_net_NoRouteToHostException\nTest_decaf_net_PlainDatagramSo
cketImpl\nTest_decaf_net_PlainSocketImpl\nTest_decaf_net_Socket\nTest_decaf_net_SocketException\nTest_decaf_net_SocketImpl\nTest_decaf_net_SocketInputStream\nTest_decaf_net_SocketOutputStream\nTest_decaf_net_UnknownHostException\nTest_decaf_util_ArrayEnumerator\nTest_decaf_util_Date\nTest_decaf_util_EventObject\nTest_decaf_util_HashEnumerator\nTest_decaf_util_Hashtable\nTest_decaf_util_Properties\nTest_decaf_util_ResourceBundle\nTest_decaf_util_tm\nTest_decaf_util_Vector\n";
+ baos = new ByteArrayOutputStream();
+ os = new DataOutputStream( baos );
+ is = NULL;
+ bais = NULL;
+ }
+ virtual void tearDown(){
+ try {
+ delete os;
+ delete baos;
+ delete is;
+ delete bais;
+ } catch(...) {}
+ }
void test();
void testString();
void testUTF();
+ void testConstructor();
+ void testRead1();
+ void testRead2();
+ void test_readBoolean();
+ void test_readByte();
+ void test_readChar();
+ void test_readDouble();
+ void test_readFloat();
+ void test_readFully1();
+ void test_readFully2();
+ void test_readFullyNullArray();
+ void test_readFullyNullStream();
+ void test_readFullyNullStreamNullArray();
+ void test_readInt();
+ void test_readLong();
+ void test_readShort();
+ void test_readUnsignedByte();
+ void test_readUnsignedShort();
+ void test_skipBytes();
+
+ private:
+
+ void openDataInputStream() {
+ bais = new ByteArrayInputStream( baos->toByteArray(), baos->size()
);
+ is = new DataInputStream( bais );
+ }
};