Class UniversalDiskImage
java.lang.Object
org.applecommander.image.UniversalDiskImage
- All Implemented Interfaces:
CapabilityProvider, HintProvider, Source, Container, InformationProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancan(Capability capability) Helps identify capabilities of the existing component.<T> Optional<T> getInfo()getName()The name of the source.intgetSize()Indicates the physical size of this image on disk.booleanIndicates if this source has changed.voidhasChanged(boolean hasChanged) Sets the changed indicator.booleanRead all bytes from this source.readBytes(int offset, int length) Read a range of bytes from this source.voidreplaceAllBytes(DataBuffer data) Replace ALL bytes in this Source.voidsave()Save the image back to the origin.voidwriteBytes(int offset, DataBuffer data) Write bytes to this source.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HintProvider
isAnyMethods inherited from interface Source
extensionLike, isApproxBetween, isApproxEQ
-
Field Details
-
MAGIC
public static final int MAGIC- See Also:
-
HEADER_SIZE
public static final int HEADER_SIZE- See Also:
-
HEADER_SIZE_ALT
public static final int HEADER_SIZE_ALT- See Also:
-
-
Constructor Details
-
UniversalDiskImage
-
-
Method Details
-
getInfo
-
can
Description copied from interface:CapabilityProviderHelps identify capabilities of the existing component.- Specified by:
canin interfaceCapabilityProvider
-
getSize
-
getName
-
get
-
is
- Specified by:
isin interfaceHintProvider
-
readAllBytes
Description copied from interface:SourceRead all bytes from this source.- Specified by:
readAllBytesin interfaceSource
-
readBytes
Description copied from interface:SourceRead a range of bytes from this source. -
writeBytes
Description copied from interface:SourceWrite bytes to this source. Updates the changed status.- Specified by:
writeBytesin interfaceSource
-
replaceAllBytes
Description copied from interface:SourceReplace ALL bytes in this Source.- Specified by:
replaceAllBytesin interfaceSource
-
hasChanged
public boolean hasChanged()Description copied from interface:SourceIndicates if this source has changed.- Specified by:
hasChangedin interfaceSource
-
hasChanged
public void hasChanged(boolean hasChanged) Description copied from interface:SourceSets the changed indicator.- Specified by:
hasChangedin interfaceSource
-
save
Description copied from interface:SourceSave 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#canto 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
FileStorein question.- Specified by:
savein interfaceSource- Throws:
IOException- if an error occurs while saving the source.
-
information
- Specified by:
informationin interfaceInformationProvider
-