2#ifndef __binary_writer_h__
3#define __binary_writer_h__
5#include "system/idisposable.h"
6#include "system/text/encoding.h"
7#include "system/io/seekorigin.h"
8#include "system/io/stream.h"
9#include "system/array.h"
10#include "system/decimal.h"
13namespace System {
namespace IO {
36 ASPOSECPP_SHARED_API
void Flush();
38 ASPOSECPP_SHARED_API
void Close();
40 ASPOSECPP_SHARED_API
void Dispose()
override;
48 virtual ASPOSECPP_SHARED_API
void Write(uint8_t value);
62 virtual ASPOSECPP_SHARED_API
void Write(
bool value);
65 virtual ASPOSECPP_SHARED_API
void Write(
char16_t value);
68 virtual ASPOSECPP_SHARED_API
void Write(int16_t value);
71 virtual ASPOSECPP_SHARED_API
void Write(
int value);
74 virtual ASPOSECPP_SHARED_API
void Write(int64_t value);
77 virtual ASPOSECPP_SHARED_API
void Write(uint16_t value);
80 virtual ASPOSECPP_SHARED_API
void Write(uint32_t value);
83 virtual ASPOSECPP_SHARED_API
void Write(uint64_t value);
86 virtual ASPOSECPP_SHARED_API
void Write(
float value);
89 virtual ASPOSECPP_SHARED_API
void Write(
double value);
98 virtual ASPOSECPP_SHARED_API
void Write(
const char_t* value);
103 ASPOSECPP_SHARED_API
void Dispose(
bool disposing);
Represents a decimal number. This type should be allocated on stack and passed to functions by value ...
Definition: decimal.h:107
Defines method that releases resources owned by the current object. Objects of this class should only...
Definition: idisposable.h:30
Represents a writer that writes values of primitive types to a byte stream. Objects of this class sho...
Definition: binary_writer.h:19
virtual void Write(uint64_t value)
Writes the specified unsigned 64-bit integer value to the output stream.
virtual void Write(char16_t value)
Writes the specified 16-bit wide character value to the output stream.
virtual void Write(uint8_t value)
Writes the specified unsigned 8-bit integer value to the output stream.
virtual void Write(double value)
Writes the specified double-precision floating point value to the output stream.
void Close()
Closes the current BinaryWriter object and the underlying output stream.
virtual void Write(const ArrayPtr< uint8_t > &buffer, int index=0, int count=-1)
Writes the specified subrange of bytes from the specified byte array to the output stream.
virtual void Write(uint32_t value)
Writes the specified unsigned 32-bit integer value to the output stream.
void Dispose() override
Releases all resources used by the current object and closes the undelying stream.
~BinaryWriter()
Destructor.
virtual void Write(int value)
Writes the specified 32-bit integer value to the output stream.
virtual void Write(uint16_t value)
Writes the specified unsigned 16-bit integer value to the output stream.
int64_t Seek(int offset, System::IO::SeekOrigin origin=System::IO::SeekOrigin::Begin)
Sets the position of the stream represented by the current object.
virtual void Write(const char_t *value)
Writes a length-prefixed string in the current encoding to the output stream.
void Write7BitEncodedInt(int value)
Writes int value byte by byte.
virtual void Write(float value)
Writes the specified single-precision floating point value to the output stream.
virtual void Write(bool value)
Writes single byte with a value of 0 if value is 'true' and 1 if value is 'false' to the output strea...
virtual void Write(const String &value)
Writes a length-prefixed string in the current encoding to the output stream.
virtual void Write(int16_t value)
Writes the specified 16-bit integer value to the output stream.
void Dispose(bool disposing)
Releases all resources used by the current object and closes the undelying stream.
virtual void Write(const ArrayPtr< char_t > &buffer, int index=0, int count=-1)
Writes the specified subrange of UTF-16 characters from the specified character array to the output s...
BinaryWriter(const StreamPtr &stream, const EncodingPtr &encoding=System::Text::Encoding::get_UTF8Unmarked(), bool leaveopen=false)
Constructs an instance of BinaryWriter class that writes data to the specified stream using the speci...
void Flush()
Flushes the output stream.
virtual void Write(int64_t value)
Writes the specified 64-bit integer value to the output stream.
StreamPtr get_BaseStream()
Returns the output stream.
virtual void Write(const Decimal &value)
Writes the byte representation of the specified Decimal value to the output stream.
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
static EncodingPtr get_UTF8Unmarked()
Only internal, to be used by the class libraries: Unmarked and non-input-validating.
SharedPtr< BinaryWriter > BinaryWriterPtr
An alias for a shared pointer to this class.
Definition: binary_writer.h:123
SeekOrigin
Specifies the reference position in the stream relative to which the position to seek to is specified...
Definition: seekorigin.h:11
@ Begin
Beginning of the stream.
Definition: db_command.h:9