Class File.UploadStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Enclosing class:
File

private class File.UploadStream
extends BufferedOutputStream
This class is used for uploading a file. It keeps track of the number of bytes uploaded and sets the size accordingly.
See Also:
File.getUploadStream(boolean)
  • Field Details

    • closed

      private boolean closed
      If this file closed or not.
    • totalBytes

      private long totalBytes
      Number of bytes written to the stream.
    • md5

      private MessageDigest md5
      The md5 sum calculater.
    • file

      private File file
      The file to write to.
    • compress

      private boolean compress
      If the file should be compressed or not.
    • checkMd5

      private boolean checkMd5
      If the md5 should be checked or not.
    • utf8Tester

      private File.CharsetTesterThread utf8Tester
  • Constructor Details

    • UploadStream

      private UploadStream​(File file, boolean calculateMd5, boolean checkMd5, boolean compress, boolean utf8Detect) throws IOException
      Create a new UploadStream and connect it to the given file.
      Parameters:
      file - The physical file path to which the stream will write
      calculateMd5 - TRUE if an md5 sum should be calculated from this uploadstream
      checkMd5 - If the md5 sum of the file should be checked agains the previously stored md5 sum, useful for making sure secondary storage is working properly
      utf8Detect - If set, we try to parse the file as UTF-8. If this works we set the encoding to UTF-8
      Throws:
      IOException - If there is an error during the upload
  • Method Details