Sha256: 6dcb681f17b7bb70cbb824827d49c999363350be52bf6f2c9f1c2cda14f5540b
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# -*- coding: binary -*- module Rex module Java module Serialization module Model # This class provides a Long Utf string representation class LongUtf < Utf # Deserializes a Rex::Java::Serialization::Model::LongUtf # # @param io [IO] the io to read from # @return [self] if deserialization succeeds # @return [nil] if deserialization doesn't succeed def decode(io) raw_length = io.read(8) if raw_length.nil? || raw_length.length != 8 raise ::RuntimeError, 'Failed to unserialize LongUtf' end self.length = raw_length.unpack('Q>')[0] if length == 0 self.contents = '' else self.contents = io.read(length) if contents.nil? || contents.length != length raise ::RuntimeError, 'Failed to unserialize LongUtf' end end self end # Serializes the Rex::Java::Serialization::Model::LongUtf # # @return [String] def encode encoded = [length].pack('Q>') encoded << contents encoded end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rex-2.0.8 | lib/rex/java/serialization/model/long_utf.rb |
rex-2.0.7 | lib/rex/java/serialization/model/long_utf.rb |
rex-2.0.5 | lib/rex/java/serialization/model/long_utf.rb |