當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。