Class: WaveFile::ChunkReaders::BaseChunkReader
- Inherits:
-
Object
- Object
- WaveFile::ChunkReaders::BaseChunkReader
- Defined in:
- lib/wavefile/chunk_readers/base_chunk_reader.rb
Overview
Internal
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#raise_error(exception_class, message) ⇒ Object
18 19 20 |
# File 'lib/wavefile/chunk_readers/base_chunk_reader.rb', line 18 def raise_error(exception_class, ) raise exception_class, "Not a supported wave file. #{}" end |
#read_entire_chunk_body(chunk_id) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/wavefile/chunk_readers/base_chunk_reader.rb', line 5 def read_entire_chunk_body(chunk_id) raw_bytes = @io.read(@chunk_size) if raw_bytes.nil? raw_bytes = "" end if raw_bytes.length < @chunk_size raise_error InvalidFormatError, "'#{chunk_id}' chunk indicated size of #{@chunk_size} bytes, but could only read #{raw_bytes.length} bytes." end raw_bytes end |