com.sun.squawk.flash
Class NorFlashMemoryHeap
java.lang.Object
com.sun.squawk.flash.NorFlashMemoryHeap
- All Implemented Interfaces:
- INorFlashMemoryHeap
public class NorFlashMemoryHeap
- extends Object
- implements INorFlashMemoryHeap
BLOCK_FOOTER
public static final byte[] BLOCK_FOOTER
BLOCK_HEADER_SIZE
public static final int BLOCK_HEADER_SIZE
- See Also:
- Constant Field Values
ERASED_VALUE
public static final byte ERASED_VALUE
- See Also:
- Constant Field Values
ERASED_VALUE_XOR
public static final byte ERASED_VALUE_XOR
- See Also:
- Constant Field Values
currentSectorState
protected INorFlashSectorState currentSectorState
erasedSequenceCurrentValue
protected int erasedSequenceCurrentValue
hasScannedBlocks
protected boolean hasScannedBlocks
inUseSectorStateList
protected INorFlashSectorStateList inUseSectorStateList
sectorStates
protected INorFlashSectorState[] sectorStates
toBeErasedSectorStateList
protected INorFlashSectorStateList toBeErasedSectorStateList
NorFlashMemoryHeap
protected NorFlashMemoryHeap()
NorFlashMemoryHeap
public NorFlashMemoryHeap(int purpose)
- Parameters:
purpose
- One of INorFlashMemorySector.USER_PURPOSED
- Throws:
IOException
NorFlashMemoryHeap
public NorFlashMemoryHeap(INorFlashSectorState[] sectorStates)
allocateAndWriteBlock
public Address allocateAndWriteBlock(byte[] bytes,
int offset,
int length,
INorFlashMemoryHeapScanner scanner)
throws RecordStoreException
- Specified by:
allocateAndWriteBlock
in interface INorFlashMemoryHeap
- Throws:
RecordStoreException
forceEraseAll
public void forceEraseAll()
- Specified by:
forceEraseAll
in interface INorFlashMemoryHeap
freeBlockAt
public void freeBlockAt(Address address)
throws RecordStoreException
- Specified by:
freeBlockAt
in interface INorFlashMemoryHeap
- Throws:
RecordStoreException
getBlockAt
public IMemoryHeapBlock getBlockAt(Address address)
throws RecordStoreException
- Specified by:
getBlockAt
in interface INorFlashMemoryHeap
- Throws:
RecordStoreException
getBlockAt
protected boolean getBlockAt(IMemoryHeapBlock block,
INorFlashSectorState sectorState,
int offset)
throws RecordStoreException
- Parameters:
block
- sectorState
- offset
-
- Returns:
- boolean true if there was a block at that address, false if not
- Throws:
RecordStoreException
getErasedSequenceCurrentValue
public long getErasedSequenceCurrentValue()
- Specified by:
getErasedSequenceCurrentValue
in interface INorFlashMemoryHeap
getNorFlashSectors
public static Vector getNorFlashSectors(int purpose)
- Returns:
- SquawkVector
getSectorContaining
public INorFlashSectorState getSectorContaining(Address address)
getSizeAvailable
public int getSizeAvailable()
throws RecordStoreException
- Specified by:
getSizeAvailable
in interface INorFlashMemoryHeap
- Throws:
RecordStoreException
incrementErasedSequence
public int incrementErasedSequence()
init
protected void init(INorFlashSectorState[] sectorStates)
makeRoomToWrite
protected void makeRoomToWrite(int entrySize,
INorFlashMemoryHeapScanner scanner)
throws RecordStoreException
- Throws:
RecordStoreException
scanBlocks
public void scanBlocks(INorFlashMemoryHeapScanner scanner)
throws RecordStoreException
- It is guaranteed that the order that blocks were allocated in, is the order in which they will be iterated.
- Specified by:
scanBlocks
in interface INorFlashMemoryHeap
- Parameters:
scanner
-
- Throws:
RecordStoreException
writeBlock
protected Address writeBlock(IMemoryHeapBlock block,
INorFlashMemoryHeapScanner scanner,
Address oldAddress)
throws RecordStoreException
- Throws:
RecordStoreException
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.