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.StringpathSeparatorstatic java.lang.Stringseparatorstatic charseparatorChar
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanRead()booleancanWrite()intcompareTo(SFile other)java.io.Fileconv()java.io.BufferedOutputStreamcreateBufferedOutputStream()java.io.FileOutputStreamcreateFileOutputStream()java.io.FileOutputStreamcreateFileOutputStream(boolean append)java.io.PrintStreamcreatePrintStream()java.io.PrintStreamcreatePrintStream(java.lang.String charset)java.io.PrintWritercreatePrintWriter()java.io.PrintWritercreatePrintWriter(java.lang.String charset)static SFilecreateTempFile(java.lang.String prefix, java.lang.String suffix)voiddelete()voiddeleteOnExit()booleanequals(java.lang.Object obj)booleanexists()SFilefile(java.lang.String name)static SFilefromFile(java.io.File internal)SFilegetAbsoluteFile()java.lang.StringgetAbsolutePath()SFilegetCanonicalFile()java.lang.StringgetName()SFilegetParentFile()java.lang.StringgetPath()java.lang.StringgetPrintablePath()inthashCode()booleanisAbsolute()booleanisDirectory()booleanisFile()longlastModified()longlength()java.lang.String[]list()java.util.Collection<SFile>listFiles()voidmkdirs()java.io.BufferedReaderopenBufferedReader()java.io.InputStreamopenFile()java.awt.image.BufferedImagereadRasterImageFromFile()booleanrenameTo(SFile dest)voidsetWritable(boolean b)java.lang.StringtoString()java.net.URItoURI()
-
-
-
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:
toStringin 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:
compareToin 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin 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.FileNotFoundExceptionjava.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.FileNotFoundExceptionjava.io.UnsupportedEncodingException
-
-