1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00
metasploit-framework/lib/bindata/rest.rb
Ramon de C Valle f124597a56 Code cleanups
git-svn-id: file:///home/svn/framework3/trunk@5773 4d416f70-5f16-0410-b530-b9f4589650da
2008-10-19 21:03:39 +00:00

41 lines
882 B
Ruby

require "bindata/single"
module BinData
# Rest will consume the input stream from the current position to the end of
# the stream. This will mainly be useful for debugging and developing.
#
# require 'bindata'
#
# class A < BinData::MultiValue
# string :a, :read_length => 5
# rest :rest
# end
#
# obj = A.read("abcdefghij")
# obj.a #=> "abcde"
# obj.rest #=" "fghij"
#
class Rest < BinData::Single
# Register this class
register(self.name, self)
#---------------
private
# Return the string representation that +val+ will take when written.
def val_to_str(val)
val
end
# Read a number of bytes from +io+ and return the value they represent.
def read_val(io)
io.raw_io.read
end
# Returns an empty string as default.
def sensible_default
""
end
end
end