26int64 juce_fileSetPosition (
void* handle, int64 pos);
45 return currentPosition;
53 currentPosition = juce_fileSetPosition (fileHandle,
newPosition);
59bool FileOutputStream::flushBuffer()
63 if (bytesInBuffer > 0)
65 ok = (writeInternal (buffer, bytesInBuffer) == (
ssize_t) bytesInBuffer);
80 jassert (
src !=
nullptr && ((
ssize_t) numBytes) >= 0);
82 if (bytesInBuffer + numBytes < bufferSize)
84 memcpy (buffer + bytesInBuffer,
src, numBytes);
85 bytesInBuffer += numBytes;
86 currentPosition += (int64) numBytes;
93 if (numBytes < bufferSize)
95 memcpy (buffer + bytesInBuffer,
src, numBytes);
96 bytesInBuffer += numBytes;
97 currentPosition += (int64) numBytes;
101 auto bytesWritten = writeInternal (
src, numBytes);
103 if (bytesWritten < 0)
106 currentPosition += (int64) bytesWritten;
107 return bytesWritten == (
ssize_t) numBytes;
116 jassert (((
ssize_t) numBytes) >= 0);
118 if (bytesInBuffer + numBytes < bufferSize)
120 memset (buffer + bytesInBuffer,
byte, numBytes);
121 bytesInBuffer += numBytes;
122 currentPosition += (int64) numBytes;
Holds a resizable array of primitive or copy-by-value objects.
bool writeRepeatedByte(uint8 byte, size_t numTimesToRepeat) override
Writes a byte to the output stream a given number of times.
bool write(const void *, size_t) override
Writes a block of data to the stream.
~FileOutputStream() override
Destructor.
bool setPosition(int64) override
Tries to move the stream's output position.
void flush() override
If the stream is using a buffer, this will ensure it gets written out to the destination.
int64 getPosition() override
Returns the stream's current position.
FileOutputStream(const File &fileToWriteTo, size_t bufferSizeToUse=16384)
Creates a FileOutputStream.
Represents a local file or directory.
virtual bool writeRepeatedByte(uint8 byte, size_t numTimesToRepeat)
Writes a byte to the output stream a given number of times.