|  | 
| virtual | ~OutputStream () | 
|  | Destructor. 
 | 
|  | 
| virtual void | flush ()=0 | 
|  | If the stream is using a buffer, this will ensure it gets written out to the destination. 
 | 
|  | 
| virtual bool | setPosition (int64 newPosition)=0 | 
|  | Tries to move the stream's output position. 
 | 
|  | 
| virtual int64 | getPosition ()=0 | 
|  | Returns the stream's current position. 
 | 
|  | 
| virtual bool | write (const void *dataToWrite, size_t numberOfBytes)=0 | 
|  | Writes a block of data to the stream. 
 | 
|  | 
| virtual bool | writeByte (char byte) | 
|  | Writes a single byte to the stream. 
 | 
|  | 
| virtual bool | writeBool (bool boolValue) | 
|  | Writes a boolean to the stream as a single byte. 
 | 
|  | 
| virtual bool | writeShort (short value) | 
|  | Writes a 16-bit integer to the stream in a little-endian byte order. 
 | 
|  | 
| virtual bool | writeShortBigEndian (short value) | 
|  | Writes a 16-bit integer to the stream in a big-endian byte order. 
 | 
|  | 
| virtual bool | writeInt (int value) | 
|  | Writes a 32-bit integer to the stream in a little-endian byte order. 
 | 
|  | 
| virtual bool | writeIntBigEndian (int value) | 
|  | Writes a 32-bit integer to the stream in a big-endian byte order. 
 | 
|  | 
| virtual bool | writeInt64 (int64 value) | 
|  | Writes a 64-bit integer to the stream in a little-endian byte order. 
 | 
|  | 
| virtual bool | writeInt64BigEndian (int64 value) | 
|  | Writes a 64-bit integer to the stream in a big-endian byte order. 
 | 
|  | 
| virtual bool | writeFloat (float value) | 
|  | Writes a 32-bit floating point value to the stream in a binary format. 
 | 
|  | 
| virtual bool | writeFloatBigEndian (float value) | 
|  | Writes a 32-bit floating point value to the stream in a binary format. 
 | 
|  | 
| virtual bool | writeDouble (double value) | 
|  | Writes a 64-bit floating point value to the stream in a binary format. 
 | 
|  | 
| virtual bool | writeDoubleBigEndian (double value) | 
|  | Writes a 64-bit floating point value to the stream in a binary format. 
 | 
|  | 
| virtual bool | writeRepeatedByte (uint8 byte, size_t numTimesToRepeat) | 
|  | Writes a byte to the output stream a given number of times. 
 | 
|  | 
| virtual bool | writeCompressedInt (int value) | 
|  | Writes a condensed binary encoding of a 32-bit integer. 
 | 
|  | 
| virtual bool | writeString (const String &text) | 
|  | Stores a string in the stream in a binary format. 
 | 
|  | 
| virtual bool | writeText (const String &text, bool asUTF16, bool writeUTF16ByteOrderMark, const char *lineEndings) | 
|  | Writes a string of text to the stream. 
 | 
|  | 
| virtual int64 | writeFromInputStream (InputStream &source, int64 maxNumBytesToWrite) | 
|  | Reads data from an input stream and writes it to this stream. 
 | 
|  | 
| void | setNewLineString (const String &newLineString) | 
|  | Sets the string to write to the stream when a new line is written. 
 | 
|  | 
| const String & | getNewLineString () const noexcept | 
|  | Returns the current new-line string that was set by setNewLineString(). 
 | 
|  | 
The base class for streams that write data to some kind of destination. 
Input and output streams are used throughout the library - subclasses can override some or all of the virtual functions to implement their behaviour.
- See also
- InputStream, MemoryOutputStream, FileOutputStream 
  
  | 
        
          | virtual bool OutputStream::writeCompressedInt | ( | int | value | ) |  |  | virtual | 
 
Writes a condensed binary encoding of a 32-bit integer. 
If you're storing a lot of integers which are unlikely to have very large values, this can save a lot of space, because values under 0xff will only take up 2 bytes, under 0xffff only 3 bytes, etc.
The format used is: number of significant bytes + up to 4 bytes in little-endian order.
- Returns
- false if the write operation fails for some reason 
- See also
- InputStream::readCompressedInt 
 
 
  
  | 
        
          | virtual bool OutputStream::writeString | ( | const String & | text | ) |  |  | virtual | 
 
Stores a string in the stream in a binary format. 
This isn't the method to use if you're trying to append text to the end of a text-file! It's intended for storing a string so that it can be retrieved later by InputStream::readString().
It writes the string to the stream as UTF8, including the null termination character.
For appending text to a file, instead use writeText, or operator<<
- Returns
- false if the write operation fails for some reason 
- See also
- InputStream::readString, writeText, operator<< 
 
 
  
  | 
        
          | virtual bool OutputStream::writeText | ( | const String & | text, |  
          |  |  | bool | asUTF16, |  
          |  |  | bool | writeUTF16ByteOrderMark, |  
          |  |  | const char * | lineEndings ) |  | virtual | 
 
Writes a string of text to the stream. 
It can either write the text as UTF-8 or UTF-16, and can also add the UTF-16 byte-order-mark bytes (0xff, 0xfe) to indicate the endianness (these should only be used at the start of a file).
If lineEndings is nullptr, then line endings in the text won't be modified. If you pass "\\n" or "\\r\\n" then this function will replace any existing line feeds.
- Returns
- false if the write operation fails for some reason