public class VirtualLocalFile extends Object implements VirtualFile
VirtualLocalFile class represents a source file in memory. Each VirtualLocalFile instance
is given a parent that corresponds to a valid directory in the filesystem. Path
resolution is done as if VirtualLocalFile instances represented real files in the filesystem.
You can not create an instance of the VirtualLocalFile class directly. You must
use the VirtualLocalFileSystem class to create them.
VirtualLocalFileSystem| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this
VirtualLocalFile object. |
boolean |
equals(Object obj)
Compares this object with the specified object.
|
InputStream |
getInputStream()
Returns the text in this
VirtualLocalFile object in an InputStream. |
long |
getLastModified()
Gets the last modified time of this
VirtualLocalFile object. |
String |
getMimeType()
Returns The MIME type of this
VirtualLocalFile object. |
String |
getName()
Gets the name of this
VirtualLocalFile object. |
String |
getNameForReporting()
Gets the name of this
VirtualLocalFile for error reporting. |
String |
getParent()
Gets the parent directory path of this
VirtualLocalFile object. |
String |
getURL()
Throws an
UnsupportedOperationException exception. |
int |
hashCode()
Returns the hash code of this
VirtualLocalFile object. |
boolean |
isDirectory()
Returns
true if this VirtualLocalFile object is a directory. |
boolean |
isTextBased()
Returns
true if the content of this VirtualLocalFile object is text based. |
VirtualFile |
resolve(String relativeStr)
Resolves the specified relative path to a
VirtualFile instance. |
long |
size()
Returns the length of the text in this
VirtualLocalFile object. |
byte[] |
toByteArray()
Returns the text in this
VirtualLocalFile object in an byte[]. |
String |
toString() |
public String getName()
VirtualLocalFile object. This is sually a canonical path.getName in interface VirtualFileVirtualLocalFile object.public String getNameForReporting()
VirtualLocalFile for error reporting. This is usually a canonical path.getNameForReporting in interface VirtualFilegetName()public String getURL()
UnsupportedOperationException exception.getURL in interface VirtualFilepublic String getParent()
VirtualLocalFile object.getParent in interface VirtualFilepublic boolean isDirectory()
true if this VirtualLocalFile object is a directory. This method always returns false.isDirectory in interface VirtualFilefalse.public long size()
VirtualLocalFile object.size in interface VirtualFilepublic String getMimeType()
VirtualLocalFile object.getMimeType in interface VirtualFilepublic InputStream getInputStream() throws IOException
VirtualLocalFile object in an InputStream.
The text is converted into a byte stream based on UTF-8 encoding.getInputStream in interface VirtualFileInputStream.IOException - Thrown when an I/O error occurs.public byte[] toByteArray()
throws IOException
VirtualLocalFile object in an byte[].toByteArray in interface VirtualFileIOExceptionpublic long getLastModified()
VirtualLocalFile object.getLastModified in interface VirtualFilepublic VirtualFile resolve(String relativeStr)
VirtualFile instance.resolve in interface SinglePathResolverrelativeStr - The relative path to be resolved.VirtualFile for relativeStr.public void close()
VirtualLocalFile object. This method does nothing.close in interface VirtualFilepublic boolean equals(Object obj)
equals in interface VirtualFileequals in class Objectobj - An Object.true if obj == this.public int hashCode()
VirtualLocalFile object.hashCode in interface VirtualFilehashCode in class Objectpublic boolean isTextBased()
true if the content of this VirtualLocalFile object is text based.
This method always returns true.isTextBased in interface VirtualFiletrue.Copyright © 2016 The Apache Software Foundation. All rights reserved.