Class SFile
java.lang.Object
net.sourceforge.plantuml.security.SFile
- All Implemented Interfaces:
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRead()
boolean
canWrite()
int
conv()
createFileOutputStream
(boolean append) createPrintStream
(String charset) createPrintStream
(Charset charset) createPrintWriter
(String charset) static SFile
createTempFile
(String prefix, String suffix) void
delete()
void
boolean
boolean
exists()
static SFile
static BufferedImage
getName()
getPath()
int
hashCode()
boolean
boolean
boolean
isFile()
boolean
isFileOk()
Check SecurityProfile to see if this file can be open.long
long
length()
String[]
list()
void
mkdirs()
openFile()
boolean
void
setWritable
(boolean b) toString()
toURI()
-
Field Details
-
separator
-
pathSeparator
-
separatorChar
public static char separatorChar
-
-
Constructor Details
-
SFile
-
SFile
-
SFile
-
SFile
-
-
Method Details
-
toString
-
fromFile
-
file
-
exists
public boolean exists() -
getCanonicalFile
- Throws:
IOException
-
isAbsolute
public boolean isAbsolute() -
isDirectory
public boolean isDirectory() -
getName
-
isFile
public boolean isFile() -
lastModified
public long lastModified() -
compareTo
- Specified by:
compareTo
in interfaceComparable<SFile>
-
getPath
-
length
public long length() -
canWrite
public boolean canWrite() -
setWritable
public void setWritable(boolean b) -
delete
public void delete() -
listFiles
-
list
-
getAbsoluteFile
-
getParentFile
-
hashCode
public int hashCode() -
equals
-
getAbsolutePath
-
getPrintablePath
-
canRead
public boolean canRead() -
deleteOnExit
public void deleteOnExit() -
mkdirs
public void mkdirs() -
createTempFile
- Throws:
IOException
-
toURI
-
renameTo
-
isFileOk
public boolean isFileOk()Check SecurityProfile to see if this file can be open. -
readRasterImageFromFile
-
getBufferedImageFromWebpButHeader
-
openBufferedReader
-
conv
-
openFile
-
createBufferedOutputStream
- Throws:
FileNotFoundException
-
createPrintWriter
- Throws:
FileNotFoundException
-
createPrintWriter
public PrintWriter createPrintWriter(String charset) throws FileNotFoundException, UnsupportedEncodingException -
createFileOutputStream
- Throws:
FileNotFoundException
-
createFileOutputStream
- Throws:
FileNotFoundException
-
createPrintStream
- Throws:
FileNotFoundException
-
createPrintStream
public PrintStream createPrintStream(String charset) throws FileNotFoundException, UnsupportedEncodingException -
createPrintStream
public PrintStream createPrintStream(Charset charset) throws FileNotFoundException, UnsupportedEncodingException
-