当前位置: 首页>>代码示例>>Java>>正文


Java DiskFullException类代码示例

本文整理汇总了Java中com.webcodepro.applecommander.storage.DiskFullException的典型用法代码示例。如果您正苦于以下问题:Java DiskFullException类的具体用法?Java DiskFullException怎么用?Java DiskFullException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DiskFullException类属于com.webcodepro.applecommander.storage包,在下文中一共展示了DiskFullException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFile

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Create a FileEntry.
 */
public FileEntry createFile() throws DiskFullException {
	byte[] vtoc = readVtoc();
	int track = AppleUtil.getUnsignedByte(vtoc[1]);
	int sector = AppleUtil.getUnsignedByte(vtoc[2]);
	while (sector != 0) { // bug fix: iterate through all catalog _sectors_
		byte[] catalogSector = readSector(track, sector);
		int offset = 0x0b;
		while (offset < 0xff) {	// iterate through all entries
			int value = AppleUtil.getUnsignedByte(catalogSector[offset]);
			if (value == 0 || value == 0xff) {
				return new GutenbergFileEntry(this, track, sector, offset);
			}
			offset+= GutenbergFileEntry.FILE_DESCRIPTIVE_ENTRY_LENGTH;
		}
		track = catalogSector[1];
		sector = catalogSector[2];
	}
	throw new DiskFullException(textBundle.get("DosFormatDisk.NoMoreSpaceError")); //$NON-NLS-1$
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:23,代码来源:GutenbergFormatDisk.java

示例2: findFreeBlock

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Locate a free block in the Volume Bitmap.
 */
protected int findFreeBlock(byte[] volumeBitmap) throws DiskFullException {
	int block = 1;
	int blocksOnDisk = getBitmapLength();
	while (block < blocksOnDisk) {
		if (isBlockFree(volumeBitmap,block)) {
			if ((block+1) * BLOCK_SIZE <= getPhysicalSize()) {
				return block;
			}
			throw new ProdosDiskSizeDoesNotMatchException(
				textBundle.get("ProdosFormatDisk.ProdosDiskSizeDoesNotMatchError")); //$NON-NLS-1$
		}
		block++;
	}
	throw new DiskFullException(
		textBundle.get("ProdosFormatDisk.NoFreeBlockAvailableError")); //$NON-NLS-1$
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:20,代码来源:ProdosFormatDisk.java

示例3: createFile

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Create a FileEntry.
 */
public FileEntry createFile() throws DiskFullException {
	byte[] vtoc = readVtoc();
	int track = AppleUtil.getUnsignedByte(vtoc[1]);
	int sector = AppleUtil.getUnsignedByte(vtoc[2]);
	while (sector != 0) { // bug fix: iterate through all catalog _sectors_
		byte[] catalogSector = readSector(track, sector);
		int offset = 0x0b;
		while (offset < 0xff) {	// iterate through all entries
			int value = AppleUtil.getUnsignedByte(catalogSector[offset]);
			if (value == 0 || value == 0xff) {
				return new DosFileEntry(this, track, sector, offset);
			}
			offset+= DosFileEntry.FILE_DESCRIPTIVE_ENTRY_LENGTH;
		}
		track = catalogSector[1];
		sector = catalogSector[2];
	}
	throw new DiskFullException(textBundle.get("DosFormatDisk.NoMoreSpaceError")); //$NON-NLS-1$
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:23,代码来源:DosFormatDisk.java

示例4: setAddress

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Set the address that this file loads at.
 */
public void setAddress(int address) {
	try {
		byte[] rawdata = disk.getFileData(this);
		if (rawdata == null || rawdata.length == 0) {
			this.address = new Integer(address);
		} else {
			AppleUtil.setWordValue(rawdata, 0, address);
			disk.setFileData(this, rawdata);
		}
	} catch (DiskFullException e) {
		// Should not be possible when the file isn't being modified!!
		throw new IllegalStateException(textBundle.
				format("DosFileEntry.UnableToSetAddressError", getFilename())); //$NON-NLS-1$
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:19,代码来源:DosFileEntry.java

示例5: testChangeDosImageOrder

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
public void testChangeDosImageOrder() throws DiskFullException {
	// Straight DOS disk in standard DOS order
	DosFormatDisk dosDiskDosOrder = DosFormatDisk.create("dostemp.dsk",  //$NON-NLS-1$
		new DosOrder(new ByteArrayImageLayout(Disk.APPLE_140KB_DISK)))[0];
	FileEntry fileEntry = dosDiskDosOrder.createFile();
	fileEntry.setFilename("TESTFILE"); //$NON-NLS-1$
	fileEntry.setFiletype("T"); //$NON-NLS-1$
	fileEntry.setFileData("This is a test file.".getBytes()); //$NON-NLS-1$
	// A duplicate - then we change it to a NIB disk image...
	DosFormatDisk dosDiskNibbleOrder = DosFormatDisk.create("dostemp2.nib", //$NON-NLS-1$
		new NibbleOrder(new ByteArrayImageLayout(Disk.APPLE_140KB_DISK)))[0];
	AppleUtil.changeImageOrderByTrackAndSector(dosDiskDosOrder.getImageOrder(),
		dosDiskNibbleOrder.getImageOrder());
	// Confirm that these disks are identical:
	assertTrue(AppleUtil.disksEqualByTrackAndSector(dosDiskDosOrder, dosDiskNibbleOrder));
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:17,代码来源:AppleUtilTest.java

示例6: testChangeProdosImageOrder

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
public void testChangeProdosImageOrder() throws DiskFullException {
	// Straight ProDOS disk in standard ProDOS block order
	ProdosFormatDisk prodosDiskDosOrder = ProdosFormatDisk.create("prodostemp.po",  //$NON-NLS-1$
		"prodostemp", //$NON-NLS-1$
		new ProdosOrder(new ByteArrayImageLayout(Disk.APPLE_140KB_DISK)))[0];
	FileEntry fileEntry = prodosDiskDosOrder.createFile();
	fileEntry.setFilename("TESTFILE"); //$NON-NLS-1$
	fileEntry.setFiletype("TXT"); //$NON-NLS-1$
	fileEntry.setFileData("This is a test file.".getBytes()); //$NON-NLS-1$
	// A duplicate - then we change it to a NIB disk image...
	ProdosFormatDisk prodosDiskNibbleOrder = ProdosFormatDisk.create("prodostemp2.nib", //$NON-NLS-1$
		"prodostemp2", //$NON-NLS-1$
		new NibbleOrder(new ByteArrayImageLayout(Disk.APPLE_140KB_DISK)))[0];
	AppleUtil.changeImageOrderByBlock(prodosDiskDosOrder.getImageOrder(),
		prodosDiskNibbleOrder.getImageOrder());
	// Confirm that these disks are identical:
	assertTrue(AppleUtil.disksEqualByBlock(prodosDiskDosOrder, prodosDiskNibbleOrder));
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:19,代码来源:AppleUtilTest.java

示例7: findFreeBlock

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Locate a free block in the Volume Bitmap.
 */
protected int findFreeBlock(byte[] volumeBitmap) throws DiskFullException {
	int block = 1;
	int blocksOnDisk = getBitmapLength();
	while (block < blocksOnDisk) {
		if (isBlockFree(volumeBitmap,block)) {
			if ((block+1) * BLOCK_SIZE < getPhysicalSize()) {
				return block;
			}
			throw new ProdosDiskSizeDoesNotMatchException(
				textBundle.get("ProdosFormatDisk.ProdosDiskSizeDoesNotMatchError")); //$NON-NLS-1$
		}
		block++;
	}
	throw new DiskFullException(
		textBundle.get("ProdosFormatDisk.NoFreeBlockAvailableError")); //$NON-NLS-1$
}
 
开发者ID:marvinmalkowskijr,项目名称:applecommander,代码行数:20,代码来源:ProdosFormatDisk.java

示例8: main

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
public static void main(String[] args)
  throws IOException, DiskFullException 
{
  try
  {
    if (args[0].equals("-get")) {
      getDirFromImg(args[1], args[2], args[3]);
      return;
    }
    if (args[0].equals("-put")) {
      putDirToImg(args[1], args[2], args[3]);
      return;
    }
  }
  catch (ArrayIndexOutOfBoundsException e)
  { }
  System.err.format("Usage: A2copy [-get imgFile srcImgDir destLocalDir] | [-put imgFile dstImgDir srcLocalDir]\n");
  System.err.format("       where srcImgDir/dstImgDir is a subdirectory in the image, or / for the root directory.\n");
  System.exit(1);
}
 
开发者ID:badvision,项目名称:lawless-legends,代码行数:21,代码来源:A2Copy.java

示例9: getDirFromImg

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Extract all the files and subdirectories from one directory in an image file, and
 * write them to the local filesystem.
 * 
 * @throws IOException        if something goes wrong
 * @throws DiskFullException  this actually can't happen (because we're not creating dirs)
 */
static void getDirFromImg(String imgFile, String srcImgDir, String dstLocalDir) throws IOException, DiskFullException
{
  // Create the local dir if necessary.
  File localDirFile = new File(dstLocalDir);
  localDirFile.mkdirs();
  
  // Open the image file and get the disk inside it.
  FormattedDisk fd = new Disk(imgFile).getFormattedDisks()[0];

  // Locate the right subdirectory on the disk.
  DirectoryEntry imgDir = findSubDir(fd, srcImgDir, false);
  
  // Recursively extract the files from that subdirectory.
  getAllFiles((List<FileEntry>)imgDir.getFiles(), localDirFile);
}
 
开发者ID:badvision,项目名称:lawless-legends,代码行数:23,代码来源:A2Copy.java

示例10: findSubDir

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
static DirectoryEntry findSubDir(DirectoryEntry imgDir, String subDirs, boolean create) 
  throws DiskFullException
{
  Matcher m = pathPat.matcher(subDirs);
  if (m.matches())
  {
    // Process next component of the directory path.
    String subName = m.group(1);
    String remaining = m.group(2);
    for (FileEntry e : (List<FileEntry>)imgDir.getFiles()) {
      if (!e.isDeleted() && e.isDirectory() && e.getFilename().equalsIgnoreCase(subName))
        return findSubDir((DirectoryEntry)e, remaining, create);
    }

    // Not found. If we're not allowed to create it, error out.
    if (!create) {
      System.err.format("Error: subdirectory '%s' not found.\n", subDirs);
      System.exit(2);
    }

    // Create the subdirectory and continue to sub-sub-dirs.
    return findSubDir(imgDir.createDirectory(subName.toUpperCase()), remaining, create);
  }
  
  return imgDir;
}
 
开发者ID:badvision,项目名称:lawless-legends,代码行数:27,代码来源:A2Copy.java

示例11: putDirToImg

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Put a whole directory of files/subdirs from the local filesystem into a 
 * subdirectory of an image file.
 * 
 * @param imgFilePath         path to the image file
 * @param dstImgDir           subdirectory in the image file, or "/" for the root
 * @param srcLocalDir         directory containing files and subdirs
 * @throws DiskFullException  if the image file fills up
 * @throws IOException        if something else goes wrong
 */
static void putDirToImg(String imgFilePath, String dstImgDir, String srcLocalDir)
  throws IOException, DiskFullException 
{
  // Make sure the local dir exists.
  File localDirFile = new File(srcLocalDir);
  if (!localDirFile.isDirectory()) {
    System.err.format("Error: Local directory '%s' not found.\n", srcLocalDir);
    System.exit(2);
  }
  
  // Open the image file.
  FormattedDisk fd = new Disk(imgFilePath).getFormattedDisks()[0];
  
  // Get to the right sub-directory.
  DirectoryEntry ent = findSubDir(fd, dstImgDir, true);
  
  // And fill it up.
  putAllFiles(fd, ent, localDirFile);
}
 
开发者ID:badvision,项目名称:lawless-legends,代码行数:30,代码来源:A2Copy.java

示例12: putFile

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Put fileName from the local filesytem into the file named fileOnImageName on the disk named imageName;
 * Note: only volume level supported; input size unlimited.
 */
public static void putFile(String fileName, String imageName, String fileOnImageName, String fileType, String address) throws IOException, DiskFullException {
	Name name = new Name(fileOnImageName);
	File file = new File(fileName);
	if (!file.canRead())
	{
		throw new IOException("Unable to read input file named "+fileName+"."); // FIXME - NLS
	}
	ByteArrayOutputStream buf = new ByteArrayOutputStream();
	byte[] inb = new byte[1024];
	int byteCount = 0;
	InputStream is = new FileInputStream(file);
	while ((byteCount = is.read(inb)) > 0) {
		buf.write(inb, 0, byteCount);
	}
	Disk disk = new Disk(imageName);
	FormattedDisk[] formattedDisks = disk.getFormattedDisks();
	FormattedDisk formattedDisk = formattedDisks[0];
	FileEntry entry = name.createEntry(formattedDisk);
	if (entry != null) {
		entry.setFiletype(fileType);
		entry.setFilename(name.name);
		entry.setFileData(buf.toByteArray());
		if (entry.needsAddress()) {
			entry.setAddress(stringToInt(address));
		}
		formattedDisk.save();
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:33,代码来源:ac.java

示例13: putCC65

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Put file fileName into the file named fileOnImageName on the disk named imageName;
 * Assume a cc65 style four-byte header with start address in bytes 0-1.
 */
public static void putCC65(String fileName, String imageName, String fileOnImageName, String fileType)
	throws IOException, DiskFullException {

	byte[] header = new byte[4];
	if (System.in.read(header, 0, 4) == 4) {
		int address = AppleUtil.getWordValue(header, 0);
		putFile(fileName, imageName, fileOnImageName, fileType, Integer.toString(address));
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:14,代码来源:ac.java

示例14: storageError

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Delete this temporary entry, inserted by PascalFormatDisk.createFile(),
 * and exit via DiskFullException.
 * @author John B. Matthews
 */
private void storageError(String s) throws DiskFullException {
	if (this.index > 0) {
		List<PascalFileEntry> dir = disk.getDirectory();
		int count = dir.size();
		dir.remove(this.index);
		PascalFileEntry volEntry = (PascalFileEntry) dir.get(0);
		volEntry.setFileCount(count - 2);
		dir.set(0, volEntry);
		disk.putDirectory(dir);
		throw new DiskFullException(s);
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:18,代码来源:PascalFileEntry.java

示例15: findEOL

import com.webcodepro.applecommander.storage.DiskFullException; //导入依赖的package包/类
/**
 * Find index of last CR < 1023 bytes from offset.
 * @author John B. Matthews
 */
private int findEOL(byte[] data, int offset) throws DiskFullException  {
	int i = offset + 1022;
	while (i > offset) {
		if (data[i] == 13) {
			return i;
		}
		i--;
	}
	storageError(textBundle.get("PascalFileEntry.LineLengthError")); //$NON-NLS-1$
	return 0;
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:16,代码来源:PascalFileEntry.java


注:本文中的com.webcodepro.applecommander.storage.DiskFullException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。