Sha256: ce1cde75514860429e515f1125c4cd8c53b70da75a03981732dd0b136ff4a509

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

module OSC
  class NetworkPacket
    def initialize(str) 
      @str, @index = str, 0 
    end
    
    def to_s
      @str
    end
    
    def rem() 
      @str.length - @index 
    end
    
    def eof? () 
      rem <= 0 
    end
    
    def skip(n) 
      @index += n 
    end
    
    def skip_padding() 
      skip((4 - (@index % 4)) % 4) 
    end
 
    def getn(n)
    	raise EOFError if rem < n
    	s = @str[@index, n]
    	skip(n)
    	s
    end

    def getc
    	raise EOFError if rem < 1
    	c = @str[@index]
    	skip(1)
    	c
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aberant-osc-ruby-0.1.6 lib/osc-ruby/network_packet.rb