26int64 juce_fileSetPosition (
void* handle,
int64 pos);
52 auto num = readInternal (buffer, (
size_t)
bytesToRead);
53 currentPosition += (
int64) num;
65 return currentPosition;
73 if (pos != currentPosition)
74 currentPosition = juce_fileSetPosition (fileHandle, pos);
76 return currentPosition == pos;
90 void runTest()
override
92 beginTest (
"Open stream non-existent file");
98 expect (stream.failedToOpen());
101 beginTest (
"Open stream existing file");
108 expect (stream.openedOk());
111 const MemoryBlock
data (
"abcdefghijklmnopqrstuvwxyz", 26);
113 f.appendData (
data.getData(),
data.getSize());
114 FileInputStream stream (f);
118 expectEquals (stream.getPosition(), (
int64) 0);
119 expectEquals (stream.getTotalLength(), (
int64)
data.getSize());
120 expectEquals (stream.getNumBytesRemaining(), stream.getTotalLength());
121 expect (! stream.isExhausted());
135 expectEquals (stream.getPosition(), (
int64)
data.getSize());
136 expectEquals (stream.getNumBytesRemaining(), (
int64) 0);
137 expect (stream.isExhausted());
144 stream.setPosition (0);
145 expectEquals (stream.getPosition(), (
int64) 0);
146 expectEquals (stream.getTotalLength(), (
int64)
data.getSize());
147 expectEquals (stream.getNumBytesRemaining(), stream.getTotalLength());
148 expect (! stream.isExhausted());
164 expectEquals (stream.getPosition(), (
int64)
data.getSize());
165 expectEquals (stream.getNumBytesRemaining(), (
int64) 0);
166 expect (stream.isExhausted());
Represents a local file or directory.
int64 getSize() const
Returns the size of the file in bytes.
static File createTempFile(StringRef fileNameEnding)
Returns a temporary file in the system's temp directory.
This is a base class for classes that perform a unit test.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
long long int64
A platform-independent 64-bit integer type.