42 auto numToRead = (
int)
std::min (size, (
size_t) 0x70000000);
46 if (numRead < 0)
return (ssize_t) numRead;
47 if (numRead == 0)
break;
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;
137 if (
read (n.asBytes, 8) == 8)
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 constexpr uint32 bigEndianInt(const void *bytes) noexcept
Turns 4 bytes into a big-endian integer.
static constexpr uint32 littleEndianInt(const void *bytes) noexcept
Turns 4 bytes into a little-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 constexpr uint16 bigEndianShort(const void *bytes) noexcept
Turns 2 bytes into a big-endian integer.
static constexpr uint16 littleEndianShort(const void *bytes) noexcept
Turns 2 bytes into a little-endian integer.
static Type swapIfBigEndian(Type value) noexcept
Swaps the byte order of a signed or unsigned integer if the CPU is big-endian.
Very simple container class to hold a pointer to some data on the heap.
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.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
signed int int32
A platform-independent 32-bit signed integer type.
unsigned long long uint64
A platform-independent 64-bit unsigned integer type.
Type * addBytesToPointer(Type *basePointer, IntegerType bytes) noexcept
A handy function which adds a number of bytes to any type of pointer and returns the result.
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
long long int64
A platform-independent 64-bit integer type.