Module: BinaryWriterMixin

### Home Classes Methods

### In Files

- lib/binary_writer.rb

### Methods

- #write_byte
- #write_int16_little
- #write_int16_native
- #write_int16_network
- #write_int32_little
- #write_int32_native
- #write_int32_network
- #write_int8
- #write_word16_little
- #write_word16_native
- #write_word16_network
- #write_word32_little
- #write_word32_native
- #write_word32_network
- #write_word8

### Class/Module Index

Quicksearch

- PostgresPR
- PostgresPR::Authentification
- PostgresPR::AuthentificationClearTextPassword
- PostgresPR::AuthentificationCryptPassword
- PostgresPR::AuthentificationKerberosV4
- PostgresPR::AuthentificationKerberosV5
- PostgresPR::AuthentificationMD5Password
- PostgresPR::AuthentificationOk
- PostgresPR::AuthentificationSCMCredential
- PostgresPR::BackendKeyData
- PostgresPR::CommandComplete
- PostgresPR::Connection
- PostgresPR::Connection::Result
- PostgresPR::CopyInResponse
- PostgresPR::CopyOutResponse
- PostgresPR::DataRow
- PostgresPR::DumpError
- PostgresPR::EmptyQueryResponse
- PostgresPR::ErrorResponse
- PostgresPR::Message
- PostgresPR::NoticeErrorMixin
- PostgresPR::NoticeResponse
- PostgresPR::ParameterStatus
- PostgresPR::Parse
- PostgresPR::ParseComplete
- PostgresPR::ParseError
- PostgresPR::PasswordMessage
- PostgresPR::Query
- PostgresPR::ReadyForQuery
- PostgresPR::RowDescription
- PostgresPR::RowDescription::FieldInfo
- PostgresPR::SSLRequest
- PostgresPR::SaltedAuthentificationMixin
- PostgresPR::StartupMessage
- PostgresPR::Terminate
- PostgresPR::UnknownAuthType
- PostgresPR::UnknownMessageType
- Buffer
- Buffer::EOF
- Buffer::Error
- Postgres
- Postgres::Conversion
- Postgres::Conversion::ConversionError
- BinaryReaderMixin
- BinaryWriterMixin
- ByteOrder
- DatabaseError
- Error
- IO
- PGError
- PGconn
- PGresult
- TC_Conversion

No matching classes.

# BinaryWriterMixin

### Public Instance Methods

write_byte(val) click to toggle source
Alias for: write_word8
write_int16_little(val) click to toggle source

    # File lib/binary_writer.rb, line 45
    def write_int16_little(val)
      pw(val, 'v')
    end

write_int16_native(val) click to toggle source

### Signed

    # File lib/binary_writer.rb, line 41
    def write_int16_native(val)
      pw(val, 's')
    end

write_int16_network(val) click to toggle source

    # File lib/binary_writer.rb, line 49
    def write_int16_network(val)
      pw(val, 'n')
    end

write_int32_little(val) click to toggle source

    # File lib/binary_writer.rb, line 79
    def write_int32_little(val)
      pw(val, 'V')
    end

write_int32_native(val) click to toggle source

### Signed

    # File lib/binary_writer.rb, line 75
    def write_int32_native(val)
      pw(val, 'l')
    end

write_int32_network(val) click to toggle source

    # File lib/binary_writer.rb, line 83
    def write_int32_network(val)
      pw(val, 'N')
    end

write_int8(val) click to toggle source

    # File lib/binary_writer.rb, line 13
    def write_int8(val)
      pw(val, 'c')
    end

write_word16_little(val) click to toggle source

    # File lib/binary_writer.rb, line 27
    def write_word16_little(val)
      str = [val].pack('S')
      str.reverse! if ByteOrder.network? # swap bytes as native=network (and we want little)
      write(str)
    end

write_word16_native(val) click to toggle source

### Unsigned

    # File lib/binary_writer.rb, line 23
    def write_word16_native(val)
      pw(val, 'S')
    end

write_word16_network(val) click to toggle source

    # File lib/binary_writer.rb, line 33
    def write_word16_network(val)
      str = [val].pack('S')
      str.reverse! if ByteOrder.little? # swap bytes as native=little (and we want network)
      write(str)
    end

write_word32_little(val) click to toggle source

    # File lib/binary_writer.rb, line 61
    def write_word32_little(val)
      str = [val].pack('L')
      str.reverse! if ByteOrder.network? # swap bytes as native=network (and we want little)
      write(str)
    end

write_word32_native(val) click to toggle source

### Unsigned

    # File lib/binary_writer.rb, line 57
    def write_word32_native(val)
      pw(val, 'L')
    end

write_word32_network(val) click to toggle source

    # File lib/binary_writer.rb, line 67
    def write_word32_network(val)
      str = [val].pack('L')
      str.reverse! if ByteOrder.little? # swap bytes as native=little (and we want network)
      write(str)
    end

write_word8(val) click to toggle source

no byteorder for 8 bit!

    # File lib/binary_writer.rb, line 9
    def write_word8(val)
      pw(val, 'C')
    end

Also aliased as: write_byte

[Validate]

Generated with the Darkfish Rdoc Generator 2.