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