public class SFile extends java.lang.Object implements java.lang.Comparable<SFile>
This class should be used instead of java.io.File. There are few exceptions (mainly in the Swing part and in the ANT task)
This class does some control access and in secure mode hide the real path of file, so that it cannot be printed to end users.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
pathSeparator |
static java.lang.String |
separator |
static char |
separatorChar |
| Constructor and Description |
|---|
SFile(SFile basedir,
java.lang.String name) |
SFile(java.lang.String nameOrPath) |
SFile(java.lang.String dirname,
java.lang.String name) |
SFile(java.net.URI uri) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead() |
boolean |
canWrite() |
int |
compareTo(SFile other) |
java.io.File |
conv() |
java.io.BufferedOutputStream |
createBufferedOutputStream() |
java.io.FileOutputStream |
createFileOutputStream() |
java.io.FileOutputStream |
createFileOutputStream(boolean append) |
java.io.PrintStream |
createPrintStream() |
java.io.PrintStream |
createPrintStream(java.nio.charset.Charset charset) |
java.io.PrintStream |
createPrintStream(java.lang.String charset) |
java.io.PrintWriter |
createPrintWriter() |
java.io.PrintWriter |
createPrintWriter(java.lang.String charset) |
static SFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix) |
void |
delete() |
void |
deleteOnExit() |
boolean |
equals(java.lang.Object obj) |
boolean |
exists() |
SFile |
file(java.lang.String name) |
static SFile |
fromFile(java.io.File internal) |
SFile |
getAbsoluteFile() |
java.lang.String |
getAbsolutePath() |
static java.awt.image.BufferedImage |
getBufferedImageFromWebpButHeader(java.io.InputStream is) |
SFile |
getCanonicalFile() |
java.lang.String |
getName() |
SFile |
getParentFile() |
java.lang.String |
getPath() |
java.lang.String |
getPrintablePath() |
int |
hashCode() |
boolean |
isAbsolute() |
boolean |
isDirectory() |
boolean |
isFile() |
boolean |
isFileOk()
Check SecurityProfile to see if this file can be open.
|
long |
lastModified() |
long |
length() |
java.lang.String[] |
list() |
java.util.Collection<SFile> |
listFiles() |
void |
mkdirs() |
java.io.BufferedReader |
openBufferedReader() |
java.io.InputStream |
openFile() |
java.awt.image.BufferedImage |
readRasterImageFromFile() |
boolean |
renameTo(SFile dest) |
void |
setWritable(boolean b) |
java.lang.String |
toString() |
java.net.URI |
toURI() |
public static java.lang.String separator
public static java.lang.String pathSeparator
public static char separatorChar
public SFile(java.lang.String nameOrPath)
public SFile(java.lang.String dirname,
java.lang.String name)
public SFile(SFile basedir, java.lang.String name)
public SFile(java.net.URI uri)
public java.lang.String toString()
toString in class java.lang.Objectpublic static SFile fromFile(java.io.File internal)
public SFile file(java.lang.String name)
public boolean exists()
public SFile getCanonicalFile() throws java.io.IOException
java.io.IOExceptionpublic boolean isAbsolute()
public boolean isDirectory()
public java.lang.String getName()
public boolean isFile()
public long lastModified()
public int compareTo(SFile other)
compareTo in interface java.lang.Comparable<SFile>public java.lang.String getPath()
public long length()
public boolean canWrite()
public void setWritable(boolean b)
public void delete()
public java.util.Collection<SFile> listFiles()
public java.lang.String[] list()
public SFile getAbsoluteFile()
public SFile getParentFile()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String getAbsolutePath()
public java.lang.String getPrintablePath()
public boolean canRead()
public void deleteOnExit()
public void mkdirs()
public static SFile createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException
java.io.IOExceptionpublic java.net.URI toURI()
public boolean renameTo(SFile dest)
public boolean isFileOk()
public java.awt.image.BufferedImage readRasterImageFromFile()
public static java.awt.image.BufferedImage getBufferedImageFromWebpButHeader(java.io.InputStream is)
public java.io.BufferedReader openBufferedReader()
public java.io.File conv()
public java.io.InputStream openFile()
public java.io.BufferedOutputStream createBufferedOutputStream()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic java.io.PrintWriter createPrintWriter()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic java.io.PrintWriter createPrintWriter(java.lang.String charset)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic java.io.FileOutputStream createFileOutputStream()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic java.io.FileOutputStream createFileOutputStream(boolean append)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic java.io.PrintStream createPrintStream()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic java.io.PrintStream createPrintStream(java.lang.String charset)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic java.io.PrintStream createPrintStream(java.nio.charset.Charset charset)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingException