public class ProvisionFilesUtil extends Object
ProvisionFilesUtil class.
Modifier and Type | Field and Description |
---|---|
protected Key |
dataDecryptionKey |
protected Key |
dataEncryptionKey |
protected String |
fileName |
protected File |
inputFile |
protected long |
inputSize |
protected String |
originalFileName |
protected long |
position |
protected int |
READ_ATTEMPTS |
Constructor and Description |
---|
ProvisionFilesUtil()
Default ctor.
|
ProvisionFilesUtil(boolean verbose)
Set verbose mode ctor.
|
Modifier and Type | Method and Description |
---|---|
static void |
calculateInputMetadata(String input,
FileMetadata metadata) |
File |
copyToFile(BufferedInputStream reader,
String output,
boolean fullOutputPath,
int bufLen,
String input,
Cipher decryptCipher,
Cipher encryptCipher,
FileMetadata metadata)
Copy reader into output using Cipher.
|
File |
copyToFile(BufferedInputStream reader,
String output,
int bufLen,
String input) |
boolean |
createSymlink(String output,
boolean fullOutputPath,
String input)
Creates symlink of input to output.
|
static String |
createTargetDirectory(String folderStore,
String email)
Creates abstract pathname.
|
static String |
createTargetPath(String folderStore,
String email,
String fileName)
Creates abstract pathname.
|
Cipher |
getDecryptCipher(String decryptKey)
Gets cipher by DecryptKey.
|
Cipher |
getEncryptCipher(String encryptKey)
Gets cipher by EncryptKey.
|
String |
getFileName()
Gets the file name.
|
static long |
getFileSize(String path)
getFileSize.
|
BufferedInputStream |
getHttpInputStream(String input,
int bufLen,
long startPosition)
getHttpInputStream.
|
String |
getOriginalFileName()
Getter for the field
originalFileName . |
BufferedInputStream |
getS3InputStream(String input,
int bufLen,
long startPosition)
getS3InputStream.
|
BufferedInputStream |
getS3InputStream(String input,
int bufLen,
long startPosition,
String accessKey,
String secretKey)
getS3InputStream.
|
URL |
getS3Url(String input)
getS3Url.
|
URL |
getS3Url(String input,
String accessKey,
String secretKey)
getS3Url.
|
BufferedInputStream |
getSourceReader(String input,
int bufLen,
long startPosition)
This attempts to resume if passed in startPosition > 0.
|
boolean |
isVerbose()
isVerbose.
|
boolean |
putToHttp()
Not supported yet.
|
boolean |
putToS3(BufferedInputStream reader,
String output,
boolean fullOutputPath)
Copy file using reader into output.
|
boolean |
putToS3(BufferedInputStream reader,
String output,
boolean fullOutputPath,
int connectionTimeout,
int maxConnections,
int maxErrorRetry,
int socketTimeout) |
boolean |
putToS3(InputStream reader,
String output,
boolean fullOutputPath,
Cipher decryptCipher,
Cipher encryptCipher)
Copy file using reader into output.
|
boolean |
putToS3(InputStream reader,
String output,
boolean fullOutputPath,
int connectionTimeout,
int maxConnections,
int maxErrorRetry,
int socketTimeout,
Cipher decryptCipher,
Cipher encryptCipher) |
void |
setDataDecryptionKeyString(String value)
Sets data decryption key.
|
void |
setDataEncryptionKeyString(String value)
Sets data encryption key.
|
void |
setOriginalFileName(String originalFileName)
Setter for the field
originalFileName . |
void |
setVerbose(boolean verbose)
Enable class verbose mode.
|
protected final int READ_ATTEMPTS
protected long inputSize
protected long position
protected String fileName
protected String originalFileName
protected File inputFile
protected Key dataEncryptionKey
protected Key dataDecryptionKey
public ProvisionFilesUtil()
public ProvisionFilesUtil(boolean verbose)
verbose
- a boolean.public String getFileName()
public boolean createSymlink(String output, boolean fullOutputPath, String input)
public Cipher getDecryptCipher(String decryptKey)
decryptKey
- a String
object.public Cipher getEncryptCipher(String encryptKey)
encryptKey
- a String
object.public File copyToFile(BufferedInputStream reader, String output, int bufLen, String input)
public File copyToFile(BufferedInputStream reader, String output, boolean fullOutputPath, int bufLen, String input, Cipher decryptCipher, Cipher encryptCipher, FileMetadata metadata)
reader
- a BufferedInputStream
object.output
- a String
object.fullOutputPath
- bufLen
- a int.input
- a String
object.metadata
- store the file size and md5sum here after checking the destinationdecryptCipher
- a Cipher
object.encryptCipher
- a Cipher
object.public boolean putToHttp()
public boolean putToS3(BufferedInputStream reader, String output, boolean fullOutputPath)
reader
- a BufferedInputStream
object.output
- a String
object.fullOutputPath
- public boolean putToS3(BufferedInputStream reader, String output, boolean fullOutputPath, int connectionTimeout, int maxConnections, int maxErrorRetry, int socketTimeout)
reader
- output
- fullOutputPath
- connectionTimeout
- maxConnections
- maxErrorRetry
- socketTimeout
- public boolean putToS3(InputStream reader, String output, boolean fullOutputPath, Cipher decryptCipher, Cipher encryptCipher)
reader
- a InputStream
object.output
- a String
object.fullOutputPath
- decryptCipher
- a Cipher
object.encryptCipher
- a Cipher
object.public boolean putToS3(InputStream reader, String output, boolean fullOutputPath, int connectionTimeout, int maxConnections, int maxErrorRetry, int socketTimeout, Cipher decryptCipher, Cipher encryptCipher)
reader
- output
- fullOutputPath
- connectionTimeout
- maxConnections
- maxErrorRetry
- socketTimeout
- decryptCipher
- encryptCipher
- public BufferedInputStream getSourceReader(String input, int bufLen, long startPosition)
input
- a String
object.bufLen
- a int.startPosition
- a long.public BufferedInputStream getHttpInputStream(String input, int bufLen, long startPosition)
getHttpInputStream.
input
- a String
object.bufLen
- a int.startPosition
- a long.BufferedInputStream
object.public BufferedInputStream getS3InputStream(String input, int bufLen, long startPosition, String accessKey, String secretKey)
getS3InputStream.
input
- a String
object.bufLen
- a int.startPosition
- a long.accessKey
- a String
object.secretKey
- a String
object.BufferedInputStream
object.public BufferedInputStream getS3InputStream(String input, int bufLen, long startPosition)
getS3InputStream.
input
- a String
object.bufLen
- a int.startPosition
- a long.BufferedInputStream
object.public void setDataEncryptionKeyString(String value)
value
- BASE64-encoded keypublic void setDataDecryptionKeyString(String value)
value
- BASE64-encoded keypublic boolean isVerbose()
isVerbose.
public void setVerbose(boolean verbose)
verbose
- a boolean.public static String createTargetPath(String folderStore, String email, String fileName)
public static String createTargetDirectory(String folderStore, String email)
public String getOriginalFileName()
Getter for the field originalFileName
.
String
object.public void setOriginalFileName(String originalFileName)
Setter for the field originalFileName
.
originalFileName
- a String
object.public static void calculateInputMetadata(String input, FileMetadata metadata) throws RuntimeException
RuntimeException
Copyright © 2015 SeqWare. All rights reserved.