Interface Source

All Superinterfaces:
CapabilityProvider, Container, HintProvider
All Known Implementing Classes:
DataBufferSource, DiskCopyImage, FileEntrySource, FileSource, UniversalDiskImage

public interface Source extends CapabilityProvider, HintProvider, Container
Source and Factory for an archive or disk in AppleCommander.

Typical usage:

   Optional<Source> sourceOpt = Sources.create(Path.of(filename));
   if (sourceOpt.isPresent()) {
     // do something with sourceOpt.get()
     System.out.println(sourceOpt.get().getSize());
   }
   // Only happens if the initiating object is not understood
   throw new RuntimeException("Unable to create image source");
  • Method Details

    • getSize

      int getSize()
    • getName

      String getName()
    • readAllBytes

      DataBuffer readAllBytes()
    • readBytes

      DataBuffer readBytes(int offset, int length)
    • writeBytes

      void writeBytes(int offset, DataBuffer data)
    • hasChanged

      boolean hasChanged()
    • clearChanges

      void clearChanges()
    • information

      List<Information> information()
    • isApproxEQ

      default boolean isApproxEQ(int value)
      Indicates if the source image is approximately equal to this size (less any image over-read). Currently, hardcoded to allow up to 10 extra bytes at the end of a disk image. Must be at least the requested size!
    • isApproxLE

      default boolean isApproxLE(int value)
      Indicates if the source image is approximately less than this size (less any image over-read). Currently, hardcoded to allow up to 10 extra bytes at the end of a disk image. Must be at least the requested size!
    • extensionLike

      default boolean extensionLike(String extension)
      Test if this name has a given file extension.