27 : blockToUse (&internalBlock)
43 jassert (externalData !=
nullptr);
48 trimExternalBlockSize();
53 trimExternalBlockSize();
56void MemoryOutputStream::trimExternalBlockSize()
58 if (blockToUse != &internalBlock && blockToUse !=
nullptr)
59 blockToUse->
setSize (size,
false);
64 if (blockToUse !=
nullptr)
74char* MemoryOutputStream::prepareToWrite (
size_t numBytes)
76 jassert ((
ssize_t) numBytes >= 0);
81 if (blockToUse !=
nullptr)
86 data =
static_cast<char*
> (blockToUse->
getData());
90 if (storageNeeded > availableSize)
93 data =
static_cast<char*
> (externalData);
96 auto* writePointer = data + position;
98 size = jmax (size, position);
107 jassert (buffer !=
nullptr);
109 if (
auto* dest = prepareToWrite (
howMany))
123 if (
auto* dest = prepareToWrite (
howMany))
150 if (blockToUse ==
nullptr)
153 if (blockToUse->
getSize() > size)
154 static_cast<char*
> (blockToUse->
getData()) [size] = 0;
164 position = jlimit ((
size_t) 0, size, (
size_t)
newPosition);
182 if (blockToUse !=
nullptr)
191 auto* d =
static_cast<const char*
> (
getData());
static size_t getBytesRequiredFor(const juce_wchar charToWrite) noexcept
void write(const juce_wchar charToWrite) noexcept
void ensureSize(const size_t minimumSize, bool initialiseNewSpaceToZero=false)
void * getData() noexcept
void setSize(const size_t newSize, bool initialiseNewSpaceToZero=false)
size_t getSize() const noexcept
const void * getData() const noexcept
~MemoryOutputStream() override
bool setPosition(int64) override
size_t getDataSize() const noexcept
bool writeRepeatedByte(uint8 byte, size_t numTimesToRepeat) override
void preallocate(size_t bytesToPreallocate)
int64 writeFromInputStream(InputStream &, int64 maxNumBytesToWrite) override
MemoryOutputStream(size_t initialSize=256)
bool write(const void *, size_t) override
bool appendUTF8Char(juce_wchar character)
MemoryBlock getMemoryBlock() const
virtual bool write(const void *dataToWrite, size_t numberOfBytes)=0
virtual int64 writeFromInputStream(InputStream &source, int64 maxNumBytesToWrite)
static String createStringFromData(const void *data, int size)