Class FileLoader

java.lang.Object
net.emustudio.emulib.io.FileLoader

public final class FileLoader extends Object
Synchronous loader of memory images (BIN, Intel HEX) and tapes (TAP, TZX).

A file is split into immutable FileLoader.Blocks which are passed to a FileLoader.Listener in playback order: TZX jumps, loops and call sequences are followed (the control blocks themselves are passed too). Loading is cancelled by interrupting the loading thread; it then throws InterruptedIOException.

For tape playback, use TapeListener which decodes tape blocks into signal callbacks.

  • Method Details

    • load

      public static void load(Path path, FileLoader.Format format, FileLoader.Listener listener) throws IOException
      Loads a file and passes its blocks to the listener.
      • BIN: one unaddressed block with the whole file
      • HEX: one addressed block per contiguous address range
      • TAP: one block (ID 0x10) per tape block
      • TZX: one block per TZX block, in playback order
      Parameters:
      path - file to load
      format - file format
      listener - receiver of blocks
      Throws:
      IOException - if the file cannot be read or is malformed, or the listener fails; InterruptedIOException if the thread was interrupted