43 return currentPosition;
51 currentPosition = juce_fileSetPosition (fileHandle,
newPosition);
57bool FileOutputStream::flushBuffer()
61 if (bytesInBuffer > 0)
63 ok = (writeInternal (buffer, bytesInBuffer) == (
ssize_t) bytesInBuffer);
83 if (bytesInBuffer + numBytes < bufferSize)
85 memcpy (buffer + bytesInBuffer, src, numBytes);
86 bytesInBuffer += numBytes;
87 currentPosition += (
int64) numBytes;
94 if (numBytes < bufferSize)
96 memcpy (buffer + bytesInBuffer, src, numBytes);
97 bytesInBuffer += numBytes;
98 currentPosition += (
int64) numBytes;
102 auto bytesWritten = writeInternal (src, numBytes);
104 if (bytesWritten < 0)
107 currentPosition += (
int64) bytesWritten;
108 return bytesWritten == (
ssize_t) numBytes;
119 if (bytesInBuffer + numBytes < bufferSize)
121 memset (buffer + bytesInBuffer,
byte, numBytes);
122 bytesInBuffer += numBytes;
123 currentPosition += (
int64) numBytes;
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.
bool openedOk() const noexcept
Returns true if the stream opened without problems.
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.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
long long int64
A platform-independent 64-bit integer type.