Skip to content

Instantly share code, notes, and snippets.

@murachue
Created March 8, 2011 16:09
Show Gist options
  • Save murachue/860457 to your computer and use it in GitHub Desktop.
Save murachue/860457 to your computer and use it in GitHub Desktop.
Add convenient methods to IO class.
class IO
def readb; return self.read(1).unpack("C")[0]; end
def readw; return self.read(2).unpack("v")[0]; end
def readl; return self.read(4).unpack("V")[0]; end
def readbw; return self.read(2).unpack("n")[0]; end
def readbl; return self.read(4).unpack("N")[0]; end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment