本文整理匯總了Java中com.sun.squawk.flash.NorFlashSectorState類的典型用法代碼示例。如果您正苦於以下問題:Java NorFlashSectorState類的具體用法?Java NorFlashSectorState怎麽用?Java NorFlashSectorState使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NorFlashSectorState類屬於com.sun.squawk.flash包,在下文中一共展示了NorFlashSectorState類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testErase
import com.sun.squawk.flash.NorFlashSectorState; //導入依賴的package包/類
public void testErase() throws IOException, RecordStoreException {
byte[] erasedMarker = NorFlashSectorState.ERASED_HEADER;
final long sequence = 10;
sector.incrementFreedBlockCount();
sector.incrementAllocatedBlockCount();
sector.erase(sequence);
assertTrue(sector.hasErasedHeader());
assertEquals(NorFlashSectorState.ERASED_HEADER_SIZE, sector.getWriteHeadPosition());
assertEquals(0, sector.getFreedBlockCount());
assertEquals(0, sector.getAllocatedBlockCount());
byte[] bytes = new byte[testSize];
sector.readBytes(0, bytes, 0, testSize);
DataInputStream input = new DataInputStream(new ByteArrayInputStream(bytes));
assertEquals(NorFlashMemoryHeap.ERASED_VALUE_XOR, input.readByte());
assertEquals(NorFlashMemoryHeap.ERASED_VALUE_XOR, input.readByte());
for (int i=0; i < erasedMarker.length; i++) {
assertEquals(erasedMarker[i], input.readByte());
}
assertEquals(input.readLong(), sequence);
assertEquals(NorFlashMemoryHeap.ERASED_VALUE_XOR, input.readByte());
assertEquals(NorFlashMemoryHeap.ERASED_VALUE_XOR, input.readByte());
}
示例2: testInitState4
import com.sun.squawk.flash.NorFlashSectorState; //導入依賴的package包/類
public void testInitState4() throws IOException {
final long sequence = 10;
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bytesOut);
dataOut.write(NorFlashMemoryHeap.ERASED_VALUE_XOR);
dataOut.write(NorFlashMemoryHeap.ERASED_VALUE_XOR);
dataOut.write(NorFlashSectorState.ERASED_HEADER);
dataOut.writeLong(sequence);
dataOut.write(NorFlashMemoryHeap.ERASED_VALUE_XOR);
dataOut.write(NorFlashMemoryHeap.ERASED_VALUE_XOR);
castSector = new NorFlashSectorState(new SimulatedNorFlashSector(Address.zero(), bytesOut.toByteArray(), 0));
sector = castSector;
assertTrue(sector.hasErasedHeader());
assertEquals(bytesOut.size(), sector.getWriteHeadPosition());
assertEquals(sequence, castSector.sequence);
}
示例3: setUp
import com.sun.squawk.flash.NorFlashSectorState; //導入依賴的package包/類
public void setUp() throws Exception {
this.testSize = 32;
assertTrue((testSize / 2) > 0);
startAddress = Address.zero();
castSector = new NorFlashSectorState(new SimulatedNorFlashSector(startAddress, testSize, 0, false));
sector = castSector;
}
示例4: testInitState2
import com.sun.squawk.flash.NorFlashSectorState; //導入依賴的package包/類
public void testInitState2() {
try {
;
castSector = new NorFlashSectorState(new SimulatedNorFlashSector(Address.zero(), new byte[] {0}, 0));
sector = castSector;
fail();
} catch (IllegalArgumentException e) {
}
}
示例5: testInitState3
import com.sun.squawk.flash.NorFlashSectorState; //導入依賴的package包/類
public void testInitState3() {
final byte[] bytes = new byte[NorFlashSectorState.ERASED_HEADER_SIZE];
castSector = new NorFlashSectorState(new SimulatedNorFlashSector(Address.zero(), bytes, 0));
sector = castSector;
assertFalse(sector.hasErasedHeader());
assertSame(0, sector.getWriteHeadPosition());
}
示例6: testResetHead
import com.sun.squawk.flash.NorFlashSectorState; //導入依賴的package包/類
public void testResetHead() {
castSector.hasErasedHeader = false;
sector.resetHead();
assertSame(0, sector.getWriteHeadPosition());
castSector.hasErasedHeader = true;
sector.resetHead();
assertEquals(NorFlashSectorState.ERASED_HEADER_SIZE, sector.getWriteHeadPosition());
}