Class TemporaryBytesManager
- java.lang.Object
-
- org.genesys.filerepository.service.ftp.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 theBytesStorageService- Author:
- Matija Obreza
-
-
Constructor Summary
Constructors Constructor Description TemporaryBytesManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamcreateInputStream(RepositoryFile repositoryFile, long offset)Creates the input stream.OutputStreamcreateOutputStream(FtpUser user, RepositoryFile repositoryFile, long offset)Creates the output stream.OutputStreamnewFile(FtpUser user, Path path)Create a local file for writing.protected byte[]readTempFileToBytes(File tempFile)Read temp file to bytes.
-
-
-
Method Detail
-
newFile
public OutputStream newFile(FtpUser user, Path path) throws IOException
Create a local file for writing. On stream close push the file toBytesStorageService- Parameters:
user- the userpath- the path- Returns:
- the output stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
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 fileoffset- 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 userrepositoryFile- the repository fileoffset- the offset- Returns:
- the output stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
-