Class: BitStream::SubStreamPacket
- Inherits:
-
Object
- Object
- BitStream::SubStreamPacket
- Defined in:
- lib/bitstream.rb
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(length) ⇒ SubStreamPacket
constructor
A new instance of SubStreamPacket.
- #read(s, offset) ⇒ Object
Constructor Details
#initialize(length) ⇒ SubStreamPacket
Returns a new instance of SubStreamPacket.
122 123 124 125 126 127 |
# File 'lib/bitstream.rb', line 122 def initialize(length) if length % 8 != 0 raise NotImplementedError, "non-aligned substream has not been supported." end @length = length end |
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
129 130 131 |
# File 'lib/bitstream.rb', line 129 def length @length end |
Class Method Details
.instance(length) ⇒ Object
118 119 120 |
# File 'lib/bitstream.rb', line 118 def self.instance(length) new length end |
Instance Method Details
#read(s, offset) ⇒ Object
131 132 133 134 135 136 |
# File 'lib/bitstream.rb', line 131 def read(s, offset) if offset % 8 != 0 raise NotImplementedError, "non-aligned substream has not been supported." end return [LazyString.new(s, offset / 8, @length / 8), @length] end |