Package com.android.io
Class FileWrapper
- java.lang.Object
-
- java.io.File
-
- com.android.io.FileWrapper
-
- All Implemented Interfaces:
IAbstractFile,IAbstractResource,java.io.Serializable,java.lang.Comparable<java.io.File>
public class FileWrapper extends java.io.File implements IAbstractFile
An implementation ofIAbstractFileextendingFile.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.android.io.IAbstractFile
IAbstractFile.PreferredWriteMode
-
-
Constructor Summary
Constructors Constructor Description FileWrapper(java.io.File file)Creates a new File instance matching a givenFileobject.FileWrapper(java.io.File parent, java.lang.String child)Creates a new File instance from a parent abstract pathname and a child pathname string.FileWrapper(java.lang.String osPathname)Creates a new File instance by converting the given pathname string into an abstract pathname.FileWrapper(java.lang.String parent, java.lang.String child)Creates a new File instance from a parent abstract pathname and a child pathname string.FileWrapper(java.net.URI uri)Creates a new File instance by converting the givenfile:URI into an abstract pathname.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()Returns whether the resource actually exists.java.io.InputStreamgetContents()Returns anInputStreamobject on the file content.longgetModificationStamp()Returns the last modification timestampjava.lang.StringgetOsLocation()Returns the OS path of the folder location (may be absolute).java.io.OutputStreamgetOutputStream()Returns anOutputStreamto write into the file.IAbstractFoldergetParentFolder()Returns the parent folder or null if there is no parent.IAbstractFile.PreferredWriteModegetPreferredWriteMode()Returns the preferred mode to write into the file.voidsetContents(java.io.InputStream source)Sets the content of the file.-
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.android.io.IAbstractResource
delete, getName, getPath
-
-
-
-
Constructor Detail
-
FileWrapper
public FileWrapper(java.io.File file)
Creates a new File instance matching a givenFileobject.- Parameters:
file- the file to match
-
FileWrapper
public FileWrapper(java.io.File parent, java.lang.String child)Creates a new File instance from a parent abstract pathname and a child pathname string.- Parameters:
parent- the parent pathnamechild- the child name- See Also:
File(File, String)
-
FileWrapper
public FileWrapper(java.lang.String osPathname)
Creates a new File instance by converting the given pathname string into an abstract pathname.- Parameters:
osPathname- the OS pathname- See Also:
File(String)
-
FileWrapper
public FileWrapper(java.lang.String parent, java.lang.String child)Creates a new File instance from a parent abstract pathname and a child pathname string.- Parameters:
parent- the parent pathnamechild- the child name- See Also:
File(String, String)
-
FileWrapper
public FileWrapper(java.net.URI uri)
Creates a new File instance by converting the givenfile:URI into an abstract pathname.- Parameters:
uri- An absolute, hierarchical URI with a scheme equal to "file", a non-empty path component, and undefined authority, query, and fragment components- See Also:
File(URI)
-
-
Method Detail
-
getContents
public java.io.InputStream getContents() throws StreamExceptionDescription copied from interface:IAbstractFileReturns anInputStreamobject on the file content. The stream must be closed by the caller.- Specified by:
getContentsin interfaceIAbstractFile- Throws:
StreamException
-
setContents
public void setContents(java.io.InputStream source) throws StreamExceptionDescription copied from interface:IAbstractFileSets the content of the file.- Specified by:
setContentsin interfaceIAbstractFile- Parameters:
source- the content- Throws:
StreamException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws StreamExceptionDescription copied from interface:IAbstractFileReturns anOutputStreamto write into the file.- Specified by:
getOutputStreamin interfaceIAbstractFile- Throws:
StreamException
-
getPreferredWriteMode
public IAbstractFile.PreferredWriteMode getPreferredWriteMode()
Description copied from interface:IAbstractFileReturns the preferred mode to write into the file.- Specified by:
getPreferredWriteModein interfaceIAbstractFile
-
getOsLocation
public java.lang.String getOsLocation()
Description copied from interface:IAbstractResourceReturns the OS path of the folder location (may be absolute).- Specified by:
getOsLocationin interfaceIAbstractResource
-
exists
public boolean exists()
Description copied from interface:IAbstractResourceReturns whether the resource actually exists.- Specified by:
existsin interfaceIAbstractResource- Overrides:
existsin classjava.io.File
-
getModificationStamp
public long getModificationStamp()
Description copied from interface:IAbstractFileReturns the last modification timestamp- Specified by:
getModificationStampin interfaceIAbstractFile
-
getParentFolder
public IAbstractFolder getParentFolder()
Description copied from interface:IAbstractResourceReturns the parent folder or null if there is no parent.- Specified by:
getParentFolderin interfaceIAbstractResource
-
-