|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webcodepro.applecommander.storage.physical.ImageOrder
public abstract class ImageOrder
Manages the interface between the physical disk image order and the logical operating system specific order. These management objects are intended to be hidden by Disk itself, although the ImageOrder may be changed (overridden).
To implement this class, over-ride the block-oriented methods (readBlock, writeBlock) or the track and sector-oriented methods (readSector, writeSector). Ensure that isBlockDevice or isTrackAndSectorDevice is set appropriately.
Note that a block is generally assumed to be an Apple ProDOS (or Apple Pascal) formatted volume where a block is 512 bytes. The track and sector device is generally a 140K 5.25" disk, although it may be an 800K 3.5" disk with two 400K DOS volumes. In either case, the sector size will be 256 bytes.
At this time, the RDOS block of 256 bytes is managed by the RdosFormatDisk, and the 1024 byte CP/M block is managed by the CpmFormatDisk (the CP/M sector of 128 bytes is largely ignored).
Design note: The physical order could alternatively be implemented with a BlockPhysicalOrder structure which includes ProdosOrder and a Track and Sector adapter, as well as a TrackAndSectorPhysicalOrder which includes a NibblePhysicalOrder and DosOrder as well as a Block adapter class. This way, Disk contains two separate classes (block as well as a track/sector) to manage the disk.
Constructor Summary | |
---|---|
ImageOrder(ByteArrayImageLayout diskImageManager)
Construct a ImageOrder. |
Method Summary | |
---|---|
void |
format()
Format the media. |
int |
getBlocksOnDevice()
Answer with the number of blocks on this device. |
ByteArrayImageLayout |
getDiskImageManager()
Get the physical disk image. |
int |
getPhysicalSize()
Answer with the physical size of this disk volume. |
int |
getSectorsPerDisk()
Answer with the total number of sectors in a disk. |
int |
getSectorsPerTrack()
Answer with the number of sectors per track on this device. |
int |
getTracksPerDisk()
Answer with the number of tracks on this device. |
abstract boolean |
isBlockDevice()
Indicates that this device is block ordered. |
boolean |
isSizeApprox(int value)
Indicates if the physical disk is approximately this size. |
abstract boolean |
isTrackAndSectorDevice()
Indicates that this device is track and sector ordered. |
abstract byte[] |
readBlock(int block)
Read the block from the disk image. |
byte[] |
readBytes(int start,
int length)
Extract a portion of the disk image. |
abstract byte[] |
readSector(int track,
int sector)
Retrieve the specified sector. |
void |
setDiskImageManager(ByteArrayImageLayout diskImageManager)
Set the physical disk image. |
abstract void |
writeBlock(int block,
byte[] data)
Write the block to the disk image. |
void |
writeBytes(int start,
byte[] bytes)
Write data to the disk image. |
abstract void |
writeSector(int track,
int sector,
byte[] bytes)
Write the specified sector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageOrder(ByteArrayImageLayout diskImageManager)
Method Detail |
---|
public ByteArrayImageLayout getDiskImageManager()
public int getPhysicalSize()
public void setDiskImageManager(ByteArrayImageLayout diskImageManager)
public byte[] readBytes(int start, int length)
public void writeBytes(int start, byte[] bytes)
public int getBlocksOnDevice()
public abstract byte[] readBlock(int block)
public abstract void writeBlock(int block, byte[] data)
public abstract boolean isBlockDevice()
public abstract boolean isTrackAndSectorDevice()
public int getTracksPerDisk()
public int getSectorsPerTrack()
public abstract byte[] readSector(int track, int sector) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public abstract void writeSector(int track, int sector, byte[] bytes) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public boolean isSizeApprox(int value)
public void format()
public int getSectorsPerDisk()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |