Package org.eclipse.xtext.generator
Class JavaIoFileSystemAccess
- java.lang.Object
-
- org.eclipse.xtext.generator.AbstractFileSystemAccess
-
- org.eclipse.xtext.generator.AbstractFileSystemAccess2
-
- org.eclipse.xtext.generator.JavaIoFileSystemAccess
-
- All Implemented Interfaces:
IFileSystemAccess
,IFileSystemAccess2
,IFileSystemAccessExtension
,IFileSystemAccessExtension2
,IFileSystemAccessExtension3
public class JavaIoFileSystemAccess extends AbstractFileSystemAccess2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
JavaIoFileSystemAccess.IFileCallback
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.generator.IFileSystemAccess
DEFAULT_OUTPUT
-
-
Constructor Summary
Constructors Constructor Description JavaIoFileSystemAccess()
JavaIoFileSystemAccess(IResourceServiceProvider.Registry registry, IEncodingProvider encodingProvider)
JavaIoFileSystemAccess(IResourceServiceProvider.Registry registry, IEncodingProvider encodingProvider, TraceFileNameProvider traceFileNameProvider, TraceRegionSerializer traceRegionSerializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createFolder(java.io.File parent)
void
deleteFile(java.lang.String fileName, java.lang.String outputConfiguration)
void
generateFile(java.lang.String fileName, java.lang.String outputCfgName, java.io.InputStream content)
Writes binary data to disk.void
generateFile(java.lang.String fileName, java.lang.String outputConfigName, java.lang.CharSequence contents)
protected void
generateTrace(java.lang.String generatedFile, java.lang.String outputConfigName, java.lang.CharSequence contents)
protected java.lang.String
getEncoding(org.eclipse.emf.common.util.URI fileURI)
protected java.io.File
getFile(java.lang.String fileName, java.lang.String outputConfigName)
org.eclipse.emf.common.util.URI
getURI(java.lang.String fileName, java.lang.String outputConfiguration)
Returns an URI for the specified path.boolean
isFile(java.lang.String path, java.lang.String outputConfigurationName)
Tests whether the file exists at the location denoted by the output configuration.boolean
isWriteTrace()
java.io.InputStream
readBinaryFile(java.lang.String fileName, java.lang.String outputCfgName)
Creates an InputStream to read a binary file from disk.java.lang.CharSequence
readTextFile(java.lang.String fileName, java.lang.String outputCfgName)
Reads a text file from disk.void
setCallBack(JavaIoFileSystemAccess.IFileCallback callBack)
void
setWriteTrace(boolean writeTrace)
protected java.lang.String
toSystemFileName(java.lang.String fileName)
java.lang.Runnable
withCallBack(JavaIoFileSystemAccess.IFileCallback callBack)
Adds the given callback to this FSA.-
Methods inherited from class org.eclipse.xtext.generator.AbstractFileSystemAccess2
generateFile, isFile, readBinaryFile, readTextFile, setContext
-
Methods inherited from class org.eclipse.xtext.generator.AbstractFileSystemAccess
deleteFile, generateFile, getCurrentSource, getOutputConfig, getOutputConfigurations, getPathes, getURI, postProcess, postProcess, setCurrentSource, setOutputConfigurations, setOutputPath, setOutputPath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.xtext.generator.IFileSystemAccess
deleteFile, generateFile
-
Methods inherited from interface org.eclipse.xtext.generator.IFileSystemAccessExtension2
getURI
-
-
-
-
Constructor Detail
-
JavaIoFileSystemAccess
public JavaIoFileSystemAccess()
-
JavaIoFileSystemAccess
public JavaIoFileSystemAccess(IResourceServiceProvider.Registry registry, IEncodingProvider encodingProvider)
- Since:
- 2.3
-
JavaIoFileSystemAccess
public JavaIoFileSystemAccess(IResourceServiceProvider.Registry registry, IEncodingProvider encodingProvider, TraceFileNameProvider traceFileNameProvider, TraceRegionSerializer traceRegionSerializer)
- Since:
- 2.4
-
-
Method Detail
-
setCallBack
public void setCallBack(JavaIoFileSystemAccess.IFileCallback callBack)
- Since:
- 2.9
-
withCallBack
public java.lang.Runnable withCallBack(JavaIoFileSystemAccess.IFileCallback callBack)
Adds the given callback to this FSA. The returned runnable allows to reset it to its previous state.- Since:
- 2.29
-
generateFile
public void generateFile(java.lang.String fileName, java.lang.String outputConfigName, java.lang.CharSequence contents) throws org.eclipse.xtext.util.RuntimeIOException
- Parameters:
fileName
- using '/' as file separatoroutputConfigName
- the name of the output configurationcontents
- the to-be-written contents.- Throws:
org.eclipse.xtext.util.RuntimeIOException
-
generateTrace
protected void generateTrace(java.lang.String generatedFile, java.lang.String outputConfigName, java.lang.CharSequence contents)
-
isWriteTrace
public boolean isWriteTrace()
- Since:
- 2.4
-
setWriteTrace
public void setWriteTrace(boolean writeTrace)
- Since:
- 2.4
-
getEncoding
protected java.lang.String getEncoding(org.eclipse.emf.common.util.URI fileURI)
- Since:
- 2.3
-
getFile
protected java.io.File getFile(java.lang.String fileName, java.lang.String outputConfigName)
- Since:
- 2.1
-
createFolder
protected void createFolder(java.io.File parent)
-
deleteFile
public void deleteFile(java.lang.String fileName, java.lang.String outputConfiguration)
- Specified by:
deleteFile
in interfaceIFileSystemAccessExtension
- Overrides:
deleteFile
in classAbstractFileSystemAccess
- Parameters:
fileName
- using '/' as file separatoroutputConfiguration
- the name of the output configuration
-
toSystemFileName
protected java.lang.String toSystemFileName(java.lang.String fileName)
-
getURI
public org.eclipse.emf.common.util.URI getURI(java.lang.String fileName, java.lang.String outputConfiguration)
Description copied from interface:IFileSystemAccessExtension2
Returns an URI for the specified path. For workspace resources a platform:/resource URI should be returned in order to pick up project specific preferences.- Since:
- 2.3
-
generateFile
public void generateFile(java.lang.String fileName, java.lang.String outputCfgName, java.io.InputStream content) throws org.eclipse.xtext.util.RuntimeIOException
Description copied from interface:IFileSystemAccessExtension3
Writes binary data to disk. For writing text, it is recommended to useIFileSystemAccess.generateFile(String, String, CharSequence)
- Throws:
org.eclipse.xtext.util.RuntimeIOException
- Since:
- 2.4
-
readBinaryFile
public java.io.InputStream readBinaryFile(java.lang.String fileName, java.lang.String outputCfgName) throws org.eclipse.xtext.util.RuntimeIOException
Description copied from interface:IFileSystemAccessExtension3
Creates an InputStream to read a binary file from disk. For text files, useIFileSystemAccessExtension3.readTextFile(String, String)
.- Throws:
org.eclipse.xtext.util.RuntimeIOException
- Since:
- 2.4
-
readTextFile
public java.lang.CharSequence readTextFile(java.lang.String fileName, java.lang.String outputCfgName) throws org.eclipse.xtext.util.RuntimeIOException
Description copied from interface:IFileSystemAccessExtension3
Reads a text file from disk. To read a binary file, useIFileSystemAccessExtension3.readBinaryFile(String, String)
.- Throws:
org.eclipse.xtext.util.RuntimeIOException
- Since:
- 2.4
-
isFile
public boolean isFile(java.lang.String path, java.lang.String outputConfigurationName) throws org.eclipse.xtext.util.RuntimeIOException
Tests whether the file exists at the location denoted by the output configuration. Returnstrue
if the file at the described location exists and is a normal file (not a directory). Otherwisefalse
.- Specified by:
isFile
in interfaceIFileSystemAccess2
- Overrides:
isFile
in classAbstractFileSystemAccess2
- Parameters:
path
- using '/' as path separatoroutputConfigurationName
- the name of the output configuration- Returns:
true
when the file at the given path exists and is a normal file. Will returnfalse
when the path belongs to a directory.- Throws:
org.eclipse.xtext.util.RuntimeIOException
-
-