Class EclipseFile
- java.lang.Object
-
- org.faktorips.devtools.abstraction.AWrapper<org.eclipse.core.resources.IResource>
-
- org.faktorips.devtools.abstraction.eclipse.internal.EclipseResource
-
- org.faktorips.devtools.abstraction.eclipse.internal.EclipseFile
-
- All Implemented Interfaces:
java.lang.Comparable<AResource>,org.eclipse.core.runtime.IAdaptable,AAbstraction,AFile,AResource
public class EclipseFile extends EclipseResource implements AFile
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.faktorips.devtools.abstraction.AResource
AResource.AResourceTreeTraversalDepth, AResource.AResourceType
-
-
Field Summary
-
Fields inherited from interface org.faktorips.devtools.abstraction.AResource
COMPARING_BY_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEclipseFile(org.eclipse.core.resources.IFile file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(java.io.InputStream source, org.eclipse.core.runtime.IProgressMonitor monitor)Creates this file in the file-system with data from the givenInputStream.java.io.InputStreamgetContents()Returns the file's data contents as anInputStream.java.lang.StringgetExtension()Returns the corresponding file's extension (the part after the last '.'), if there is any.booleanisReadOnly()Returns whether this file is read-only (meaning data can be read but not written).voidsetContents(java.io.InputStream source, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor)Overwrites this file in the file-system with data from the givenInputStream.org.eclipse.core.resources.IFileunwrap()Returns the platform-specific object corresponding to this abstraction.-
Methods inherited from class org.faktorips.devtools.abstraction.eclipse.internal.EclipseResource
copy, createMarker, delete, deleteMarkers, exists, findMarkers, getAdapter, getLocalTimeStamp, getLocation, getModificationStamp, getName, getParent, getProject, getProjectRelativePath, getType, getWorkspace, getWorkspaceRelativePath, isAccessible, isDerived, isSynchronized, move, refreshLocal, setDerived, touch
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.faktorips.devtools.abstraction.AResource
compareTo, copy, createMarker, delete, deleteMarkers, exists, findMarkers, getLocalTimeStamp, getLocation, getModificationStamp, getName, getParent, getProject, getProjectRelativePath, getType, getWorkspace, getWorkspaceRelativePath, isAccessible, isDerived, isSynchronized, move, refreshLocal, setDerived, touch
-
-
-
-
Method Detail
-
unwrap
public org.eclipse.core.resources.IFile unwrap()
Description copied from interface:AAbstractionReturns the platform-specific object corresponding to this abstraction. The generic type parameter is used to avoid casts when assigning to platform-specific objects. It is the obligation of the caller to make sure the right type is used, otherwise aClassCastExceptionwill be thrown.Sample usage:
interface ACalendar extends AAbstraction[...] class LocalDateAsCalendarWrapper extends AWrapper<LocalDate>[...] [...] ACalendar calendar = Wrappers.of(LocalDate.now()).as(ACalendar.class); [...] LocalDate date = calendar.unwrap();- Specified by:
unwrapin interfaceAAbstraction- Overrides:
unwrapin classEclipseResource- See Also:
Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.
-
create
public void create(java.io.InputStream source, org.eclipse.core.runtime.IProgressMonitor monitor)Description copied from interface:AFileCreates this file in the file-system with data from the givenInputStream.
-
getContents
public java.io.InputStream getContents()
Description copied from interface:AFileReturns the file's data contents as anInputStream.- Specified by:
getContentsin interfaceAFile- Returns:
- the file's contents
-
setContents
public void setContents(java.io.InputStream source, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor)Description copied from interface:AFileOverwrites this file in the file-system with data from the givenInputStream.- Specified by:
setContentsin interfaceAFile- Parameters:
source- provides the data to be written to the new filekeepHistory- whether to keep a history of the content (if supported by the workspace)monitor- a progress monitor that is notified about this process. The monitor may benullwhen progress does not need to be reported.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:AFileReturns whether this file is read-only (meaning data can be read but not written).- Specified by:
isReadOnlyin interfaceAFile- Returns:
- whether this file is read-only
-
getExtension
public java.lang.String getExtension()
Description copied from interface:AFileReturns the corresponding file's extension (the part after the last '.'), if there is any.- Specified by:
getExtensionin interfaceAFile- Returns:
- this file's extension or an empty String if the file has no extension
-
-