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 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

      public SFile(SFile basedir, java.lang.String name)
    • SFile

      public SFile(java.net.URI uri)
  • Method Details

    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.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 interface java.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 class java.lang.Object
    • equals

      public boolean equals(java.lang.Object obj)
      Overrides:
      equals in class java.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
    • 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