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


Java RuntimeIOException类代码示例

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


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

示例1: generateFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
@Override
public void generateFile(String fileName, String outputConfigName, CharSequence contents) throws RuntimeIOException {
	File file = getFile(fileName, outputConfigName);
	if (!getOutputConfig(outputConfigName).isOverrideExistingResources() && file.exists()) {
		return;
	}
	try {
		createFolder(file.getParentFile());
		String encoding = getEncoding(getURI(fileName, outputConfigName));
		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), encoding);
		try {
			writer.append(postProcess(fileName, outputConfigName, contents, encoding));
			if(callBack != null) 
				callBack.fileAdded(file);
			if (writeTrace)
				generateTrace(fileName, outputConfigName, contents);
		} finally {
			writer.close();
		}
	} catch (IOException e) {
		throw new RuntimeIOException(e);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:24,代码来源:JavaIoFileSystemAccess.java

示例2: readBinaryFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
@Override
public InputStream readBinaryFile(final String fileName, final String outputCfgName) throws RuntimeIOException {
  try {
    try {
      final URI uri = this.getURI(fileName, outputCfgName);
      final InputStream input = this.converter.createInputStream(uri);
      return this.beforeRead.beforeRead(uri, input);
    } catch (final Throwable _t) {
      if (_t instanceof FileNotFoundException) {
        final FileNotFoundException e = (FileNotFoundException)_t;
        throw new RuntimeIOException(e);
      } else {
        throw Exceptions.sneakyThrow(_t);
      }
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:URIBasedFileSystemAccess.java

示例3: createTempDir

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
protected File createTempDir() {
	if (temporaryFolder != null && temporaryFolder.isInitialized()) {
		try {
			return temporaryFolder.newFolder();
		} catch (IOException e) {
			throw new RuntimeIOException(e);
		}
	}
	return com.google.common.io.Files.createTempDir();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:OnTheFlyJavaCompiler.java

示例4: readBinaryFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * @since 2.4
 */
@Override
public InputStream readBinaryFile(String fileName, String outputCfgName) throws RuntimeIOException {
	File file = getFile(fileName, outputCfgName);
	try {
		return new BufferedInputStream(new FileInputStream(file));
	} catch (FileNotFoundException e) {
		throw new RuntimeIOException(e);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:JavaIoFileSystemAccess.java

示例5: generateFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * @since 2.4
 */
@Override
public void generateFile(String fileName, String outputCfgName, InputStream content) {
	try {
		try {
			byte[] byteArray = ByteStreams.toByteArray(content);
			files.put(getFileName(fileName, outputCfgName), byteArray);
		} finally {
			content.close();
		}
	} catch (IOException e) {
		throw new RuntimeIOException(e);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:InMemoryFileSystemAccess.java

示例6: readBinaryFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * @since 2.4
 */
@Override
public InputStream readBinaryFile(String fileName, String outputCfgName) throws RuntimeIOException {
	String name = getFileName(fileName, outputCfgName);
	Object contents = files.get(name);
	if (contents == null)
		throw new RuntimeIOException("File not found: " + name);
	if (contents instanceof byte[])
		return new ByteArrayInputStream((byte[]) contents);
	if (contents instanceof CharSequence)
		return new StringInputStream(contents.toString());
	throw new RuntimeIOException("Unknown File Data Type: " + contents.getClass() + " File: " + name);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:InMemoryFileSystemAccess.java

示例7: readTextFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * @since 2.4
 */
@Override
public CharSequence readTextFile(String fileName, String outputCfgName) throws RuntimeIOException {
	String name = getFileName(fileName, outputCfgName);
	Object contents = files.get(name);
	if (contents == null)
		throw new RuntimeIOException("File not found: " + name);
	if (contents instanceof CharSequence)
		return (CharSequence) contents;
	if (contents instanceof byte[])
		throw new RuntimeIOException("Can not read a binary file using readTextFile(). File: " + name);
	throw new RuntimeIOException("Unknown File Data Type: " + contents.getClass() + " File: " + name);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:InMemoryFileSystemAccess.java

示例8: internalGetResourceDescription

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
@Override
protected IResourceDescription internalGetResourceDescription(final Resource resource,
		IDefaultResourceDescriptionStrategy strategy) {
	if (resource instanceof DerivedStateAwareResource) {
		DerivedStateAwareResource res = (DerivedStateAwareResource) resource;
		if (!res.isLoaded()) {
			try {
				res.load(res.getResourceSet().getLoadOptions());
			} catch (IOException e) {
				throw new RuntimeIOException(e);
			}
		}
		boolean isInitialized = res.fullyInitialized || res.isInitializing;
		try {
			if (!isInitialized) {
				res.eSetDeliver(false);
				res.installDerivedState(true);
			}
			IResourceDescription description = createResourceDescription(resource, strategy);
			if (!isInitialized) {
				// eager initialize
				for (IEObjectDescription desc : description.getExportedObjects()) {
					desc.getEObjectURI();
				}
			}
			return description;
		} finally {
			if (!isInitialized) {
				if (log.isDebugEnabled())
					log.debug("Discarding inferred state for "+resource.getURI());
				res.discardDerivedState();
				res.eSetDeliver(true);
			}
		}
	} else {
		if (log.isDebugEnabled())
			log.debug("Invalid configuration. DerivedStateAwareResourceDescriptionManager was registered, but resource was a " + resource.getClass().getName());
		return super.internalGetResourceDescription(resource, strategy);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:41,代码来源:DerivedStateAwareResourceDescriptionManager.java

示例9: generateFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
@Override
public void generateFile(final String fileName, final String outputCfgName, final InputStream content) throws RuntimeIOException {
  try {
    final URI uri = this.getURI(fileName, outputCfgName);
    final OutputStream out = this.converter.createOutputStream(uri);
    try {
      final InputStream processedContent = this.beforeWrite.beforeWrite(uri, outputCfgName, content);
      ByteStreams.copy(processedContent, out);
    } finally {
      out.close();
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:URIBasedFileSystemAccess.java

示例10: readTextFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
@Override
public CharSequence readTextFile(final String fileName, final String outputCfgName) throws RuntimeIOException {
  try {
    final URI uri = this.getURI(fileName, outputCfgName);
    final InputStream inputstream = this.readBinaryFile(fileName, outputCfgName);
    String _encoding = this.getEncoding(uri);
    InputStreamReader _inputStreamReader = new InputStreamReader(inputstream, _encoding);
    return CharStreams.toString(_inputStreamReader);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:URIBasedFileSystemAccess.java

示例11: createFolder

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
protected void createFolder(File parent) {
	if (parent != null && !parent.mkdirs() && !parent.isDirectory())
		throw new RuntimeIOException("Could not create directory " + parent);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:JavaIoFileSystemAccess.java

示例12: isFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean isFile(String path, String outputConfigurationName) throws RuntimeIOException {
	File file = getFile(path, outputConfigurationName);
	return file!=null && file.exists() && file.isFile();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:JavaIoFileSystemAccess.java

示例13: isFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * @since 2.9
 */
@Override
public boolean isFile(String path) throws RuntimeIOException {
	return isFile(path, DEFAULT_OUTPUT);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:AbstractFileSystemAccess2.java

示例14: isFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * Tests whether the file exists at the location denoted by the output configuration.
 * Returns {@code true} if the file at the described location exists and is a normal file
 * (not a directory). Otherwise {@code false}.
 * 
 * @param path using '/' as path separator
 * @param outputConfigurationName the name of the output configuration
 * @return <code>true</code> when the file at the given path exists and is a normal file. Will return <code>false</code> when
 * the path belongs to a directory.
 */
boolean isFile (String path, String outputConfigurationName) throws RuntimeIOException;
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:12,代码来源:IFileSystemAccess2.java

示例15: generateFile

import org.eclipse.xtext.util.RuntimeIOException; //导入依赖的package包/类
/**
 * Writes binary data to disk. For writing text, it is recommended to use
 * {@link IFileSystemAccess#generateFile(String, String, CharSequence)}
 */
void generateFile(String fileName, String outputCfgName, InputStream content) throws RuntimeIOException;
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:6,代码来源:IFileSystemAccessExtension3.java


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