Class SFile
java.lang.Object
net.sourceforge.plantuml.security.SFile
- All Implemented Interfaces:
java.lang.Comparable<SFile>
Secure replacement for java.io.File.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic java.lang.String
static java.lang.String
static char
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRead()
boolean
canWrite()
int
java.io.File
conv()
java.io.BufferedOutputStream
java.io.FileOutputStream
java.io.FileOutputStream
createFileOutputStream
(boolean append) java.io.PrintStream
java.io.PrintStream
createPrintStream
(java.lang.String charset) java.io.PrintStream
createPrintStream
(java.nio.charset.Charset charset) java.io.PrintWriter
java.io.PrintWriter
createPrintWriter
(java.lang.String charset) static SFile
createTempFile
(java.lang.String prefix, java.lang.String suffix) void
delete()
void
boolean
equals
(java.lang.Object obj) boolean
exists()
file
(java.lang.String name) static SFile
fromFile
(java.io.File internal) java.lang.String
java.lang.String
getName()
java.lang.String
getPath()
java.lang.String
int
hashCode()
boolean
boolean
boolean
isFile()
long
long
length()
java.lang.String[]
list()
java.util.Collection<SFile>
void
mkdirs()
java.io.BufferedReader
java.io.InputStream
openFile()
java.awt.image.BufferedImage
boolean
void
setWritable
(boolean b) java.lang.String
toString()
java.net.URI
toURI()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
separator
public static java.lang.String separator -
pathSeparator
public static java.lang.String pathSeparator -
separatorChar
public static char separatorChar
-
-
Constructor Details
-
SFile
public SFile(java.lang.String nameOrPath) -
SFile
public SFile(java.lang.String dirname, java.lang.String name) -
SFile
-
SFile
public SFile(java.net.URI uri)
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
fromFile
-
file
-
exists
public boolean exists() -
getCanonicalFile
- Throws:
java.io.IOException
-
isAbsolute
public boolean isAbsolute() -
isDirectory
public boolean isDirectory() -
getName
public java.lang.String getName() -
isFile
public boolean isFile() -
lastModified
public long lastModified() -
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<SFile>
-
getPath
public java.lang.String getPath() -
length
public long length() -
canWrite
public boolean canWrite() -
setWritable
public void setWritable(boolean b) -
delete
public void delete() -
listFiles
-
list
public java.lang.String[] list() -
getAbsoluteFile
-
getParentFile
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj) - Overrides:
equals
in classjava.lang.Object
-
getAbsolutePath
public java.lang.String getAbsolutePath() -
getPrintablePath
public java.lang.String getPrintablePath() -
canRead
public boolean canRead() -
deleteOnExit
public void deleteOnExit() -
mkdirs
public void mkdirs() -
createTempFile
public static SFile createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException - Throws:
java.io.IOException
-
toURI
public java.net.URI toURI() -
renameTo
-
readRasterImageFromFile
public java.awt.image.BufferedImage readRasterImageFromFile() -
openBufferedReader
public java.io.BufferedReader openBufferedReader() -
conv
public java.io.File conv() -
openFile
public java.io.InputStream openFile() -
createBufferedOutputStream
public java.io.BufferedOutputStream createBufferedOutputStream() throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
createPrintWriter
public java.io.PrintWriter createPrintWriter() throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
createPrintWriter
public java.io.PrintWriter createPrintWriter(java.lang.String charset) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException - Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
-
createFileOutputStream
public java.io.FileOutputStream createFileOutputStream() throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
createFileOutputStream
public java.io.FileOutputStream createFileOutputStream(boolean append) throws java.io.FileNotFoundException - Throws:
java.io.FileNotFoundException
-
createPrintStream
public java.io.PrintStream createPrintStream() throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
createPrintStream
public java.io.PrintStream createPrintStream(java.lang.String charset) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException - Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
-
createPrintStream
public java.io.PrintStream createPrintStream(java.nio.charset.Charset charset) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException - Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
-