38 ssize_t totalRead = 0;
42 auto numToRead = (int) std::min (size, (
size_t) 0x70000000);
43 auto numRead =
read (juce::addBytesToPointer (destBuffer, totalRead), numToRead);
44 jassert (numRead <= numToRead);
46 if (numRead < 0)
return (ssize_t) numRead;
47 if (numRead == 0)
break;
49 size -= (size_t) numRead;
72 if (
read (temp, 2) == 2)
82 if (
read (temp, 2) == 2)
92 if (
read (temp, 4) == 4)
102 if (
read (temp, 4) == 4)
115 const int numBytes = (sizeByte & 0x7f);
126 if (
read (bytes, numBytes) != numBytes)
130 return (sizeByte >> 7) ? -num : num;
135 union { uint8 asBytes[8]; uint64 asInt64; } n;
137 if (
read (n.asBytes, 8) == 8)
145 union { uint8 asBytes[8]; uint64 asInt64; } n;
147 if (
read (n.asBytes, 8) == 8)
155 static_assert (
sizeof (int32) ==
sizeof (
float),
"Union assumes float has the same size as an int32");
156 union { int32 asInt;
float asFloat; } n;
163 union { int32 asInt;
float asFloat; } n;
170 union { int64 asInt;
double asDouble; } n;
177 union { int64 asInt;
double asDouble; } n;
204 if (c == 0 || c ==
'\n')
239 if (numBytesToSkip > 0)
241 auto skipBufferSize = (int) jmin (numBytesToSkip, (int64) 16384);
245 numBytesToSkip -=
read (temp, (
int) jmin (numBytesToSkip, (int64) skipBufferSize));
static JUCE_CONSTEXPR uint16 littleEndianShort(const void *bytes) noexcept
Turns 2 bytes into a little-endian integer.
static JUCE_CONSTEXPR uint16 bigEndianShort(const void *bytes) noexcept
Turns 2 bytes into a big-endian integer.
static JUCE_CONSTEXPR uint32 bigEndianInt(const void *bytes) noexcept
Turns 4 bytes into a big-endian integer.
static Type swapIfLittleEndian(Type value) noexcept
Swaps the byte order of a signed or unsigned integer if the CPU is little-endian.
static Type swapIfBigEndian(Type value) noexcept
Swaps the byte order of a signed or unsigned integer if the CPU is big-endian.
static JUCE_CONSTEXPR uint32 littleEndianInt(const void *bytes) noexcept
Turns 4 bytes into a little-endian integer.
A class to hold a resizable block of raw data.
Writes data to an internal memory buffer, which grows as required.
String toUTF8() const
Returns a String created from the (UTF8) data that has been written to the stream.
String toString() const
Attempts to detect the encoding of the data and convert it to a string.
int64 writeFromInputStream(InputStream &, int64 maxNumBytesToWrite) override
Reads data from an input stream and writes it to this stream.
virtual bool writeByte(char byte)
Writes a single byte to the stream.