Class FileLoader.Block
java.lang.Object
net.emustudio.emulib.io.FileLoader.Block
- Enclosing class:
FileLoader
Immutable block of a file.
BIN/HEX blocks carry plain bytes. Tape blocks carry an ID and the original block body: TAP blocks have ID 0x10 and body = flag, data and checksum; TZX bodies contain all fields after the block ID.
-
Method Details
-
getFormat
- Returns:
- format of the file this block comes from
-
getAddress
- Returns:
- HEX block address; empty for BIN and tape blocks
-
getId
public int getId()- Returns:
- tape block ID (TAP blocks have 0x10), or -1 for BIN/HEX blocks
-
getData
Returns BIN/HEX bytes, or a Spectrum data packet (flag, data, checksum) of TAP, TZX 0x10 and TZX 0x11 blocks.- Returns:
- copy of the data
- Throws:
IOException- if this tape block has no data packet
-
getSpectrumHeader
- Returns:
- Spectrum header, if this is a 19-byte data packet with flag 0
- Throws:
IOException- if this tape block has no data packet
-
getUsedBitsInLastByte
- Returns:
- number of used bits in the last byte of the data packet (8 except for TZX turbo blocks)
- Throws:
IOException- if this tape block has no data packet
-
hasValidChecksum
- Returns:
- true if XOR of the data packet bytes (including flag and checksum) is zero
- Throws:
IOException- if this is not a tape block with a data packet
-