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


Java FileNotFoundException.getMessage方法代碼示例

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


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

示例1: openSelectedFile

import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
 * Returns an OutputStream, depending on whether the {@link #fileOutputPort} is connected or a
 * file name is given.
 */
public OutputStream openSelectedFile() throws OperatorException {
	if (!fileOutputPort.isConnected()) {
		try {
			return new FileOutputStream(operator.getParameterAsFile(fileParameterName, true));
		} catch (FileNotFoundException e) {
			throw new UserError(operator, e, 303, operator.getParameterAsFile(fileParameterName), e.getMessage());
		}
	} else {
		return new ByteArrayOutputStream() {

			@Override
			public void close() throws IOException {
				super.close();
				fileOutputPort.deliver(new BufferedFileObject(this.toByteArray()));
			}
		};
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:23,代碼來源:FileOutputPortHandler.java

示例2: MatlabResultWriter

import java.io.FileNotFoundException; //導入方法依賴的package包/類
public MatlabResultWriter(File workingDir, String configString) {
    if ( configString.startsWith("<xml") ) {  // TODO: right prefix
        // TODO: read from config string
    } else {
        if ( configString.toLowerCase().endsWith(".m") || configString.toLowerCase().endsWith(".m(ts)") ) {
            // configString directly indicates the matlab output file
            if (configString.toLowerCase().endsWith(".m" + addTimeStampSuffix)) {
                // add messages
                addTimeStamp = true;
                configString = configString.substring(0, configString.length()-addTimeStampSuffix.length());
            }
            try {
                outputStream = new PrintStream(new File(workingDir, configString));
            } catch (FileNotFoundException e) {
                throw new RuntimeException("MatlabResultWriter: could not open " +
                        " for writing (" + e.getMessage() + ")");
            }
        }
        else {
            throw new RuntimeException("MatlabResultWriter: file name with unknown extension: " + configString);
        }
    }
}
 
開發者ID:OpenDA-Association,項目名稱:OpenDA,代碼行數:24,代碼來源:MatlabResultWriter.java

示例3: AbstractOBDHandler

import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
 * create an OBD handler from the given device
 * 
 * @param pDevice
 *          - the device to connect to
 */
public AbstractOBDHandler(VehicleGroup vehicleGroup,File pDevice) {
  this(vehicleGroup);
  this.device = pDevice;
  if (!device.exists())
    throw new IllegalArgumentException(
        "device " + device.getPath() + " does not exist");
  try {
    Connection con=this.getElm327().getCon();
    con.setInput(new FileInputStream(device));
    con.setOutput(new FileOutputStream(device));
    attachConnection(con);
  } catch (FileNotFoundException e) {
    // this shouldn't be possible we checked above that the file exists
    throw new RuntimeException("this can't happen: " + e.getMessage());
  }
}
 
開發者ID:BITPlan,項目名稱:can4eve,代碼行數:23,代碼來源:AbstractOBDHandler.java

示例4: createLogger

import java.io.FileNotFoundException; //導入方法依賴的package包/類
FileLogger createLogger(String logDirName) {
    File logFile = createLogFile(logDirName);
    try {
        return new FileLogger(logFile);
    } catch (FileNotFoundException fnfe) {
        throw new Error(fnfe.getMessage());
    }
}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:9,代碼來源:Logs.java

示例5: StandardEventsReader

import java.io.FileNotFoundException; //導入方法依賴的package包/類
public StandardEventsReader(File eventsFile){
	try {
		this.scanner = new Scanner(eventsFile);
	} catch (FileNotFoundException e) {
		throw new SimError(e.getMessage(),e);
	}
}
 
開發者ID:MaX121,項目名稱:Bachelor-Thesis,代碼行數:8,代碼來源:StandardEventsReader.java

示例6: parseFile

import java.io.FileNotFoundException; //導入方法依賴的package包/類
public void parseFile(File file) {
    try {
        parseFile(new FileInputStream(file));
    }
    catch (FileNotFoundException ex) {
        throw new DecisionTableParseException(ex.getMessage(), ex);
    }
}
 
開發者ID:CenturyLinkCloud,項目名稱:mdw-demo,代碼行數:9,代碼來源:Excel2007Parser.java

示例7: run

import java.io.FileNotFoundException; //導入方法依賴的package包/類
private void run() {
    File outputFile = new File(outputPath).getAbsoluteFile();
    if (!outputFile.getParentFile().exists()) {
        if (!outputFile.getParentFile().mkdirs()) {
            throw new RuntimeException("Unable to write to directory at " + outputFile.getParent());
        }
    }
    try (PrintWriter writer = new PrintWriter(outputPath)) {
        for (VerbNetInstance instance : new OntoNotesConverter().getInstances(Paths.get(inputPath))) {
            writer.println(VerbNetReader.VerbNetInstanceParser.toString(instance));
        }
    } catch (FileNotFoundException e) {
        throw new RuntimeException("Unable to write to output path at " + outputPath + ": " + e.getMessage(), e);
    }
}
 
開發者ID:clearwsd,項目名稱:clearwsd,代碼行數:16,代碼來源:OntoNotesConverter.java

示例8: TextTableWriter

import java.io.FileNotFoundException; //導入方法依賴的package包/類
public TextTableWriter(File workingDir, String configString) {

        writeHeader = true;

        if (configString.startsWith("<xml")) {  // TODO: right prefix
            // TODO: read from config file
        } else {
            try {
                outputStream = new PrintStream(new File(workingDir, configString));
            } catch (FileNotFoundException e) {
                throw new RuntimeException("TextTableWriter: could not open " +
                    " for writing (" + e.getMessage() + ")");
            }
        }
    }
 
開發者ID:OpenDA-Association,項目名稱:OpenDA,代碼行數:16,代碼來源:TextTableWriter.java

示例9: CsvResultWriter

import java.io.FileNotFoundException; //導入方法依賴的package包/類
public CsvResultWriter(File workingDir, String configString) {
    if ( configString.startsWith("<xml") ) {  // TODO: right prefix
        // TODO: read from config file
    } else {
        if ( configString.toLowerCase().endsWith(".csv") ) {
            // configString directly indicates the matlab output file
            try {
                outputStream = new PrintStream(new File(workingDir, configString));
            } catch (FileNotFoundException e) {
                throw new RuntimeException("CsvResultWriter: could not open " +
                        " for writing (" + e.getMessage() + ")");
            }
        }
    }
}
 
開發者ID:OpenDA-Association,項目名稱:OpenDA,代碼行數:16,代碼來源:CsvResultWriter.java

示例10: handleFileNotFound

import java.io.FileNotFoundException; //導入方法依賴的package包/類
private IOException handleFileNotFound(FileNotFoundException fnfe) throws IOException {
  // tries to refresh the store files, otherwise shutdown the RS.
  // TODO: add support for abort() of a single region and trigger
  // reassignment.
  try {
    region.refreshStoreFiles(true);
    return new IOException("unable to read store file");
  } catch (IOException e) {
    String msg = "a store file got lost: " + fnfe.getMessage();
    LOG.error(msg);
    LOG.error("unable to refresh store files", e);
    abortRegionServer(msg);
    return new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " closing");
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:HRegion.java

示例11: createWorld

import java.io.FileNotFoundException; //導入方法依賴的package包/類
@Override
public World createWorld(String worldName) throws ModuleLoadException, IOException {
    if(server.getWorlds().isEmpty()) {
        throw new IllegalStateException("Can't create a world because there is no default world to derive it from");
    }

    try {
        importDestructive(terrainOptions.worldFolder().toFile(), worldName);
    } catch(FileNotFoundException e) {
        // If files are missing, just inform the mapmaker.
        // Other IOExceptions are considered internal errors.
        throw new ModuleLoadException(e.getMessage()); // Don't set the cause, it's redundant
    }

    final WorldCreator creator = worldCreator(worldName);
    worldConfigurators.forEach(wc -> wc.configureWorld(creator));

    final World world = server.createWorld(creator);
    if(world == null) {
        throw new IllegalStateException("Failed to create world (Server.createWorld returned null)");
    }

    world.setAutoSave(false);
    world.setKeepSpawnInMemory(false);
    world.setDifficulty(Optional.ofNullable(mapInfo.difficulty)
                                .orElseGet(() -> server.getWorlds().get(0).getDifficulty()));

    return world;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:30,代碼來源:WorldManagerImpl.java

示例12: getBinaryStream

import java.io.FileNotFoundException; //導入方法依賴的package包/類
@Override
public InputStream getBinaryStream(int columnIndex) throws SQLException {
    if (file != null) {
        try {
            return new FileInputStream(file);
        } catch (FileNotFoundException e) {
            throw new SQLException(e.getMessage());
        }
    }
    return new ByteArrayInputStream(((String) resultSets.get(0).get(
            position)[columnIndex - 1]).getBytes());
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:13,代碼來源:ResultSetStub.java

示例13: getFileStream

import java.io.FileNotFoundException; //導入方法依賴的package包/類
private static InputStream getFileStream(String path, PathPrefix prefix, ScriptContext context) {
    switch (prefix) {
        case CLASSPATH: 
            return context.env.fileClassLoader.getResourceAsStream(path);
        case NONE: // relative to feature dir
            path = context.env.featureDir + File.separator + path;
            break;
        default: // as-is
    }
    try {
        return new FileInputStream(path);
    } catch (FileNotFoundException e) {
        throw new KarateFileNotFoundException(e.getMessage());
    }
}
 
開發者ID:intuit,項目名稱:karate,代碼行數:16,代碼來源:FileUtils.java

示例14: PropBagEx

import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
 * Creates a new PropBagEx from the given file's content.
 * 
 * @param file The file to read in.
 * @throws PropBagExException
 */
public PropBagEx(final File file)
{
	try
	{
		setXML(new FileInputStream(file));
	}
	catch( FileNotFoundException ex )
	{
		throw new RuntimeException(ex.getMessage(), ex);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:18,代碼來源:PropBagEx.java

示例15: getInputStream

import java.io.FileNotFoundException; //導入方法依賴的package包/類
public InputStream getInputStream() throws AccessDeniedException {
    try {
        return new LocalRepeatableFileInputStream(new File(path));
    }
    catch(FileNotFoundException e) {
        throw new LocalAccessDeniedException(e.getMessage(), e);
    }
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:9,代碼來源:Local.java


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