com.webcodepro.applecommander.storage.physical
Class ByteArrayImageLayout

java.lang.Object
  extended by com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout
Direct Known Subclasses:
UniversalDiskImageLayout

public class ByteArrayImageLayout
extends java.lang.Object

Manages the layout of the physical disk. This hides implementation details, such as if the disk is in 2IMG order.

Author:
Rob Greene (RobGreene@users.sourceforge.net)

Constructor Summary
ByteArrayImageLayout(byte[] diskImage)
          Construct a ByteArrayImageLayout.
ByteArrayImageLayout(byte[] diskImage, boolean changed)
          Construct a ByteArrayImageLayout.
ByteArrayImageLayout(int size)
          Construct a ByteArrayImageLayout.
 
Method Summary
 byte[] getDiskImage()
          Get the physical disk image.
 int getPhysicalSize()
          Answer with the physical size of this disk volume.
 boolean hasChanged()
          Indicates if the disk has changed.
 byte[] readBytes(int start, int length)
          Extract a portion of the disk image.
 void setChanged(boolean changed)
          Set the changed indicator.
 void setDiskImage(byte[] diskImage)
          Set the physical disk image.
 void writeBytes(int start, byte[] bytes)
          Write data to the disk image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayImageLayout

public ByteArrayImageLayout(byte[] diskImage)
Construct a ByteArrayImageLayout.


ByteArrayImageLayout

public ByteArrayImageLayout(byte[] diskImage,
                            boolean changed)
Construct a ByteArrayImageLayout.


ByteArrayImageLayout

public ByteArrayImageLayout(int size)
Construct a ByteArrayImageLayout.

Method Detail

getDiskImage

public byte[] getDiskImage()
Get the physical disk image.


setDiskImage

public void setDiskImage(byte[] diskImage)
Set the physical disk image.


getPhysicalSize

public int getPhysicalSize()
Answer with the physical size of this disk volume.


readBytes

public byte[] readBytes(int start,
                        int length)
Extract a portion of the disk image.


writeBytes

public void writeBytes(int start,
                       byte[] bytes)
Write data to the disk image.


hasChanged

public boolean hasChanged()
Indicates if the disk has changed. Triggered when data is written and cleared when data is saved.


setChanged

public void setChanged(boolean changed)
Set the changed indicator.