Class FileBase

java.lang.Object
de.elo.ix.jscript.FileBase
Direct Known Subclasses:
DiscFile, HttpFile

public abstract class FileBase extends Object
This class declares the methods supported by both DiscFile and HttpFile.
  • Constructor Details

    • FileBase

      public FileBase()
  • Method Details

    • copyAllBytes

      public Object copyAllBytes(FileBase destFile) throws IOException
      Copy the content of this file to the given destination file. The content is assumed to be in binary format and therfore no character set transformation is performed.
      Parameters:
      destFile - Destination file
      Returns:
      If this is a HttpFile, the server response is returned. Otherwise the return value is null.
      Throws:
      IOException
    • copyAllText

      public Object copyAllText(FileBase destFile) throws IOException
      Copy the contents of this file to the given destination file.
      Parameters:
      destFile - Destination file
      Returns:
      If this is a HttpFile, the server response is returned. Otherwise the return value is null.
      Throws:
      IOException
    • readAllBytes

      public byte[] readAllBytes() throws IOException
      Read all bytes from the file.
      Returns:
      Content as byte array.
      Throws:
      IOException
    • readAllText

      public String readAllText() throws IOException
      Read the entire content from a text file.
      Returns:
      Text content
      Throws:
      IOException
    • writeAllBytes

      public byte[] writeAllBytes(byte[] buf) throws IOException
      Write all bytes into a file.
      Parameters:
      buf - Content as byte array.
      Returns:
      depends on the implementing class
      Throws:
      IOException
    • writeAllText

      public String writeAllText(String text) throws IOException
      Write text into a file.
      Parameters:
      text - Text content
      Returns:
      depends on the implementing class
      Throws:
      IOException
    • getCharset

      public String getCharset()
      Character set resp. encoding type for HttpFile. The default character set to be used is UTF-8.
      Returns:
      Character set or null or empty. If null or empty, the default character set of the operating system is used.
    • setCharset

      public void setCharset(String charset)
      Character set resp. encoding type for HttpFile. The default character set to be used is UTF-8.
      Parameters:
      charset - Character set or null or empty. If null or empty, the default character set of the operating system is used.
    • isUseBom

      public boolean isUseBom()
      Handle Byte Order Mark. Default value is false.
      Returns:
      true, if Byte Order Mark has to be detected on read and has to be prefixed on write.
    • setUseBom

      public void setUseBom(boolean useBom)
      Handle Byte Order Mark Default value is false.
      Parameters:
      useBom - true, if Byte Order Mark has to be detected on read and has to be prefixed on write.