Package org.applecommander.source
Interface Source
- All Superinterfaces:
CapabilityProvider,Container,HintProvider
- All Known Implementing Classes:
DataBufferSource,DiskCopyImage,FileEntrySource,FileSource,UniversalDiskImage
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");
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis is the Source creation factory interface. -
Method Summary
Modifier and TypeMethodDescriptionvoiddefault booleanextensionLike(String extension) Test if this name has a given file extension.getName()intgetSize()booleandefault booleanisApproxBetween(int value1, int value2) Indicates if the source image is "approximately" between these two values (less any image over-read).default booleanisApproxEQ(int value) Indicates if the source image is approximately equal to this size (less any image over-read).readBytes(int offset, int length) voidwriteBytes(int offset, DataBuffer data) Methods inherited from interface org.applecommander.capability.CapabilityProvider
canMethods inherited from interface org.applecommander.hint.HintProvider
is, isAny
-
Method Details
-
getSize
int getSize() -
getName
String getName() -
readAllBytes
DataBuffer readAllBytes() -
readBytes
-
writeBytes
-
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 255 extra bytes at the end of a disk image. Must be at least the requested size! -
isApproxBetween
default boolean isApproxBetween(int value1, int value2) Indicates if the source image is "approximately" between these two values (less any image over-read). Currently, hardcoded to allow up to 255 extra bytes at the end of a disk image. Must be at least the requested size! -
extensionLike
Test if this name has a given file extension.
-