本文整理汇总了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()));
}
};
}
}
示例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);
}
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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() + ")");
}
}
}
示例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() + ")");
}
}
}
}
示例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");
}
}
示例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;
}
示例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());
}
示例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());
}
}
示例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);
}
}
示例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);
}
}