#include "main.h"
#include "support.h"
LT_USE_NAMESPACE(LizardTech);
{
TEST_SUCCESS(stream.
initialize(INPUT_PATH(
"meg.hdr"),
"r"));
TEST_SUCCESS(stream.
open());
TEST_BOOL(stream.
read(buf, 5) == 5);
TEST_BOOL(memcmp(buf, "NROWS", 5)==0);
TEST_BOOL(stream.
tell() == 7);
TEST_BOOL(stream.
read(buf, 2) == 2);
TEST_BOOL(memcmp(buf, "80", 2) == 0);
TEST_SUCCESS(stream.
close());
TEST_SUCCESS(stream.
open());
TEST_SUCCESS(substream.
initialize(&stream, 7, 9,
false));
TEST_SUCCESS(substream.
open());
TEST_BOOL(substream.
read(buf, 2) == 2);
TEST_BOOL(memcmp(buf, "80", 2)==0);
TEST_BOOL(stream.
tell() == 9);
TEST_BOOL(substream.
tell() == 2);
}
@ LTIO_SEEK_DIR_CUR
Offset from the current read/write position.
lt_uint32 LT_STATUS
An integral status code.
#define LT_STS_Uninit
status code indicating unintialized variable
#define LT_STS_Success
status code indicating success
unsigned char lt_uint8
unsigned 8-bit integer
virtual lt_uint32 read(lt_uint8 *pDest, lt_uint32 numBytes)
Default Constructor.
virtual LT_STATUS seek(lt_int64 offset, LTIOSeekDir origin)
Default Constructor.
virtual lt_int64 tell()
Default Constructor.
virtual LT_STATUS close()
Default Constructor.
virtual LT_STATUS initialize(const LTFileSpec &fs, const char *mode)
Initializes the stream from a file spec.
virtual LT_STATUS open()
Default Constructor.
virtual LT_STATUS initialize(LTIOStreamInf *stream, lt_int64 start, lt_int64 end, bool takeOwnership=false)
Initializes the stream.
virtual lt_uint32 read(lt_uint8 *pDest, lt_uint32 numBytes)
Retrieve the specified number of bytes from the data source and place them in pDest.
virtual LT_STATUS close()
Closes the stream.
virtual lt_int64 tell()
Returns the current data access position as an offset from the start of the data.
virtual LT_STATUS open()
Opens the stream.