当前位置: 首页>>代码示例>>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;未经允许,请勿转载。