Class TemporaryBytesManager


  • @Component
    public class TemporaryBytesManager
    extends Object
    This little beast manages a local copy of bytes for the FTP service. It makes a local copy of the bytes, allows for downloading, updating and synchronizing back to the BytesStorageService
    Author:
    Matija Obreza
    • Constructor Detail

      • TemporaryBytesManager

        public TemporaryBytesManager()
    • Method Detail

      • readTempFileToBytes

        protected byte[] readTempFileToBytes​(File tempFile)
                                      throws IOException
        Read temp file to bytes.
        Parameters:
        tempFile - the temp file
        Returns:
        the byte[]
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • createInputStream

        public InputStream createInputStream​(RepositoryFile repositoryFile,
                                             long offset)
                                      throws IOException
        Creates the input stream.
        Parameters:
        repositoryFile - the repository file
        offset - the offset
        Returns:
        the input stream
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • createOutputStream

        public OutputStream createOutputStream​(FtpUser user,
                                               RepositoryFile repositoryFile,
                                               long offset)
                                        throws IOException
        Creates the output stream.
        Parameters:
        user - the user
        repositoryFile - the repository file
        offset - the offset
        Returns:
        the output stream
        Throws:
        IOException - Signals that an I/O exception has occurred.