當前位置: 首頁>>代碼示例>>Java>>正文


Java Disk.SECTOR_SIZE屬性代碼示例

本文整理匯總了Java中com.webcodepro.applecommander.storage.Disk.SECTOR_SIZE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Disk.SECTOR_SIZE屬性的具體用法?Java Disk.SECTOR_SIZE怎麽用?Java Disk.SECTOR_SIZE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.webcodepro.applecommander.storage.Disk的用法示例。


在下文中一共展示了Disk.SECTOR_SIZE屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSize

/**
 * Compute the size of this file (in bytes).
 * @see com.webcodepro.applecommander.storage.FileEntry#getSize()
 */
public int getSize() {
	byte[] rawdata = null;
	if (!isDeleted()) {
		rawdata = disk.getFileData(this);
	}
	// default to nothing special, just compute from number of sectors
	int size = (getSectorsUsed()-1) * Disk.SECTOR_SIZE;
	if (size < 1) size = 0;	// we assume a T/S block is included (may not be)
	if (rawdata != null) {
		if ("B".equals(getFiletype())) { //$NON-NLS-1$
			// binary
			return AppleUtil.getWordValue(rawdata, 2);
		} else if ("A".equals(getFiletype()) || "I".equals(getFiletype())) { //$NON-NLS-1$ //$NON-NLS-2$
			// applesoft, integer basic
			return AppleUtil.getWordValue(rawdata, 0);
		}
	}
	return size;
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:23,代碼來源:DosFileEntry.java

示例2: getOffset

/**
 * Compute the track and sector offset into the disk image.
 * This takes into account what type of format is being dealt
 * with.
 */
protected int getOffset(int track, int sector) throws IllegalArgumentException {
	if (!isSizeApprox(Disk.APPLE_140KB_DISK) 
		&& !isSizeApprox(Disk.APPLE_800KB_DISK)
		&& !isSizeApprox(Disk.APPLE_800KB_2IMG_DISK)
		&& track != 0 && sector != 0) {		// HACK: Allows boot sector writing
		throw new IllegalArgumentException(
				textBundle.get("DosOrder.UnrecognizedFormatError")); //$NON-NLS-1$
	}
	int offset = (track * getSectorsPerTrack() + sector) * Disk.SECTOR_SIZE;
	if (offset > getPhysicalSize()) {
		throw new IllegalArgumentException(
			textBundle.format("DosOrder.InvalidSizeError", //$NON-NLS-1$
					track, sector));
	}
	return offset;
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:21,代碼來源:DosOrder.java

示例3: readSector

/**
 * Retrieve the specified sector.
 */
public byte[] readSector(int track, int sector) throws IllegalArgumentException {
	int block = track * 8 + blockInterleave[sector];
	byte[] blockData = readBlock(block);
	int offset = blockOffsets[sector];
	byte[] sectorData = new byte[Disk.SECTOR_SIZE];
	System.arraycopy(blockData, offset * Disk.SECTOR_SIZE, 
		sectorData, 0, Disk.SECTOR_SIZE); 
	return sectorData;
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:12,代碼來源:ProdosOrder.java

示例4: writeBlock

/**
 * Write the block to the disk image.
 * Note: Defined in terms of reading sectors.
 */
public void writeBlock(int block, byte[] data) {
	int track = block / 8;
	int sectorIndex = block % 8;
	int[] sectorMapping1 = { 0, 13, 11, 9, 7, 5, 3, 1 };
	int[] sectorMapping2 = { 14, 12, 10, 8, 6, 4, 2, 15 };
	int sector1 = sectorMapping1[sectorIndex];
	int sector2 = sectorMapping2[sectorIndex];
	byte[] sectorData = new byte[Disk.SECTOR_SIZE];
	System.arraycopy(data, 0, sectorData, 0, Disk.SECTOR_SIZE);
	writeSector(track, sector1, sectorData);
	System.arraycopy(data, Disk.SECTOR_SIZE, sectorData, 0, Disk.SECTOR_SIZE);
	writeSector(track, sector2, sectorData);
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:17,代碼來源:DosOrder.java

示例5: getSize

/**
 * Compute the size of this file (in bytes).
 * @see com.webcodepro.applecommander.storage.FileEntry#getSize()
 */
public int getSize() {
	// Nothing special, just compute from number of sectors
	int size = getSectorsUsed() * Disk.SECTOR_SIZE;
	return size;
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:9,代碼來源:GutenbergFileEntry.java

示例6: getTracksPerDisk

/**
 * Answer with the number of tracks on this device.
 */
public int getTracksPerDisk() {
	return getPhysicalSize() / (getSectorsPerTrack() * Disk.SECTOR_SIZE);
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:6,代碼來源:ImageOrder.java


注:本文中的com.webcodepro.applecommander.storage.Disk.SECTOR_SIZE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。