Class SFile
- java.lang.Object
-
- net.sourceforge.plantuml.security.SFile
-
- All Implemented Interfaces:
java.lang.Comparable<SFile>
public class SFile extends java.lang.Object implements 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
Fields Modifier and Type Field Description static java.lang.String
pathSeparator
static java.lang.String
separator
static char
separatorChar
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.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()
SFile
getCanonicalFile()
java.lang.String
getName()
SFile
getParentFile()
java.lang.String
getPath()
java.lang.String
getPrintablePath()
int
hashCode()
boolean
isAbsolute()
boolean
isDirectory()
boolean
isFile()
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()
-
-
-
Constructor Detail
-
SFile
public SFile(java.lang.String nameOrPath)
-
SFile
public SFile(java.lang.String dirname, java.lang.String name)
-
SFile
public SFile(SFile basedir, java.lang.String name)
-
SFile
public SFile(java.net.URI uri)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fromFile
public static SFile fromFile(java.io.File internal)
-
file
public SFile file(java.lang.String name)
-
exists
public boolean exists()
-
getCanonicalFile
public SFile getCanonicalFile() throws java.io.IOException
- 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
public int compareTo(SFile other)
- 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
public java.util.Collection<SFile> listFiles()
-
list
public java.lang.String[] list()
-
getAbsoluteFile
public SFile getAbsoluteFile()
-
getParentFile
public SFile 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
public boolean renameTo(SFile dest)
-
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
-
-