Class DiskCopyImage

java.lang.Object
org.applecommander.image.DiskCopyImage
All Implemented Interfaces:
CapabilityProvider, HintProvider, Source, Container, InformationProvider

public class DiskCopyImage extends Object implements Source
  • Field Details

  • Constructor Details

    • DiskCopyImage

      public DiskCopyImage(Source source)
  • Method Details

    • checksum

      public int checksum(int offset, int requestedLength)
      Calculate the expected checksum. Note that we try to be careful about length as there are DiskCopy images that appear to have been truncated over time. Since the checksums should NOT match, presumably the user may notice that detail!
    • can

      public boolean can(Capability capability)
      Description copied from interface: CapabilityProvider
      Helps identify capabilities of the existing component.
      Specified by:
      can in interface CapabilityProvider
    • get

      public <T> Optional<T> get(Class<T> iface)
      Specified by:
      get in interface Container
    • is

      public boolean is(Hint hint)
      Specified by:
      is in interface HintProvider
    • getInfo

      public DiskCopyImage.Info getInfo()
    • getSize

      public int getSize()
      Description copied from interface: Source
      Indicates the physical size of this image on disk.
      Specified by:
      getSize in interface Source
    • getName

      public String getName()
      Description copied from interface: Source
      The name of the source. It likely will be used in user interfaces. It could represent a file from the computer or even a file from a file store.
      Specified by:
      getName in interface Source
    • readAllBytes

      public DataBuffer readAllBytes()
      Description copied from interface: Source
      Read all bytes from this source.
      Specified by:
      readAllBytes in interface Source
    • readBytes

      public DataBuffer readBytes(int offset, int length)
      Description copied from interface: Source
      Read a range of bytes from this source.
      Specified by:
      readBytes in interface Source
    • writeBytes

      public void writeBytes(int offset, DataBuffer data)
      Description copied from interface: Source
      Write bytes to this source. Updates the changed status.
      Specified by:
      writeBytes in interface Source
    • replaceAllBytes

      public void replaceAllBytes(DataBuffer data)
      Description copied from interface: Source
      Replace ALL bytes in this Source.
      Specified by:
      replaceAllBytes in interface Source
    • hasChanged

      public boolean hasChanged()
      Description copied from interface: Source
      Indicates if this source has changed.
      Specified by:
      hasChanged in interface Source
    • hasChanged

      public void hasChanged(boolean hasChanged)
      Description copied from interface: Source
      Sets the changed indicator.
      Specified by:
      hasChanged in interface Source
    • save

      public void save() throws IOException
      Description copied from interface: Source

      Save the image back to the origin. Note that this could conceivably save back to the OS file system, or back to a file store. Use the CapabilityProvider#can to see if a save is possible. The save operation should clear the change indicator.

      For example:

      if (source.can(Capability.SAVE_SOURCE)) {
          source.save();
      }
      

      Note that the capability can be used to enable appropriate options. If source cannot be saved, a "Save As" type operation can be applied and the source switched for the FileStore in question.

      Specified by:
      save in interface Source
      Throws:
      IOException - if an error occurs while saving the source.
    • information

      public List<InformationGroup> information()
      Specified by:
      information in interface InformationProvider