| Constructor and Description |
|---|
RSFileHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
contentToHeader(String contentName)
Converts a content file name to the respective header one.
|
static void |
copy(ResultSet rs,
String src,
DataOutputStream dst)
Copies the source file to a new file
|
static void |
copy(String src,
DataOutputStream dst)
Copies the source file to an output stream
|
static void |
copy(String src,
String dst)
Copies the source file to a new file
|
static boolean |
forceConsistency(String filename)
forces the filesystem to remain consistent by using metadata changing functions
|
static String |
generateName(short type,
String seed)
Generates a name of the type that is provided which can either be unique or have the unique
value part equal to the provided one
|
static DataInputStream |
getBinaryContent(String file,
Mnemonic mne)
Retrieves the full content of the provided file
|
static byte[] |
getBytesFromFile(File file)
Read file into a byte array
|
static String |
getContent(String file,
Mnemonic mne)
Retrieves the full content of the provided file
|
static int |
getNumberOfResultsInTextFile(String filename)
Retrives the number of results in the provided file that has been structured as a text
payload part
|
static String |
headerToContent(String headerName)
Converts a header file name to the respective content one.
|
static String |
headToFlowControl(String head)
Constructs the flag used for on demand production file that corresponds to the specfic head part
|
static String |
headToFlowControlTmp(String head)
Constructs the temporary flag used for on demand production file that corresponds to the specfic head part
|
static boolean |
isReady(String filename)
Checks if the provided file is ready for consumption
|
static void |
notifyOnFlowCreation(String headname)
notidies the consumer that more records were created
|
static void |
persistContent(String filename,
String inWrap,
Mnemonic mne)
Persists the content of the provided source file to the provided target file
|
static void |
persistContent(String filename,
Vector<String> results,
int count,
Mnemonic mne)
Persists the content available in the provided vector o a file whose name is given.
|
static void |
persistHeader(HeaderRef header)
Persists a header file with the information available in its argument
|
static String |
persistStream(InputStream content)
persists the stream in a file and returns the filename
|
static HeaderRef |
populateHeader(String filename)
Populates a header info class instance from the content of the provided file
|
static Vector<String> |
populateResults(String filename,
Mnemonic mne)
Populates a record vecror with the records available in the provided file
|
static String |
publicToTmp(String pubName)
Converts a public file name to a private temparary one
|
static void |
requestFlowCreation(String headname)
notifies the producer of an RS that more records are needed
|
static void |
runGC()
Attempt to call the garbage collector
|
static String[] |
splitFile(String filename)
Splits the provided file in smaller parts as is dictated by
RSConstants.partSize |
static String |
tmpToPublic(String tmpName)
Converts a tmp file name to a public one
|
static void |
touchHeader(String filename)
Populates a header info class instance from the content of the provided file
|
static boolean |
waitForIt(String filename,
boolean flowControl,
String headname)
Waits until the provided file is ready to be consumed or a maximum amount of time has been reached.
|
static boolean |
waitForIt(String filename,
long time,
boolean flowControl,
String headname)
Waits until the provided file is ready to be consumed or a maximum amount of time has been reached.
|
static RSConstants.CONTROLFLOW |
waitOnFlowNotification(String headname,
long time)
blocks waiting for notifications on result production for the specified time period
|
public static String generateName(short type, String seed) throws Exception
type - The type of filename to generate. This can be one of RSConstants.CONTENT,
RSConstants.HEADER, RSConstants.PAGEDCONTENTseed - If a non null value is provided, The unique part of the generated file
will have the supplied value. Otherwise, a unique value is generated and usedException - An unrecoverable for the operation error occuredpublic static String headToFlowControl(String head)
head - The head file of the RSpublic static String headToFlowControlTmp(String head)
head - The head file of the RSpublic static RSConstants.CONTROLFLOW waitOnFlowNotification(String headname, long time)
headname - The head filetime - The timeoutpublic static void notifyOnFlowCreation(String headname)
headname - The head name of the RS that needed more resultspublic static void requestFlowCreation(String headname)
headname - The head name of the RS that needs more resultspublic static String publicToTmp(String pubName) throws Exception
pubName - The file name to convertException - An unrecoverable for the operation error occuredpublic static String tmpToPublic(String tmpName) throws Exception
tmpName - the temporary nameException - An unrecoverable for the operation error occuredpublic static String headerToContent(String headerName) throws Exception
headerName - THe header name to convertException - An unrecoverable for the operation error occuredpublic static String contentToHeader(String contentName) throws Exception
contentName - The content name to convertException - An unrecoverable for the operation error occuredpublic static void persistContent(String filename, Vector<String> results, int count, Mnemonic mne) throws Exception
filename - The filename to perist the content inresults - The vector holding the payloadmne - the encryption classcount - The number of records to persist. If this is negative, all the available records are persistedException - An unrecoverable for the operation error occuredpublic static boolean forceConsistency(String filename) throws Exception
filename - the filenameException - An error has occuredpublic static void persistContent(String filename, String inWrap, Mnemonic mne) throws Exception
filename - The target fileinWrap - The source filemne - the encryption classException - An unrecoverable for the operation error occurredpublic static void persistHeader(HeaderRef header) throws Exception
header - The header infoException - An unrecoverable for the operation error occuredpublic static HeaderRef populateHeader(String filename) throws Exception
filename - The file holding the header payloadException - An unrecoverable for the operation error occuredpublic static void touchHeader(String filename)
filename - The file holding the header to touchpublic static boolean waitForIt(String filename, boolean flowControl, String headname)
RSConstants.sleepMax in millisecondsfilename - The filename to wait forflowControl - whether or not the RS supports on demand production of resultsheadname - The head file name of this RSpublic static boolean waitForIt(String filename, long time, boolean flowControl, String headname)
filename - The filename to wait fortime - The maximum time in milliseconds to wait for the fileflowControl - whether or not the RS supports on demand production of resultsheadname - The head file name of this RSpublic static boolean isReady(String filename)
filename - The name of the file to check if it is readytrue if it is, false otherwisepublic static Vector<String> populateResults(String filename, Mnemonic mne) throws Exception
filename - The file to retrieve the records frommne - the encryption classException - An unrecoverable for the operation error occuredpublic static String getContent(String file, Mnemonic mne) throws Exception
file - The file whose content must be retrievedmne - the encryption classException - An unrecoverable for the operation error occurredpublic static DataInputStream getBinaryContent(String file, Mnemonic mne) throws Exception
file - The file whose content must be retrievedmne - the encryption classException - An unrecoverable for the operation error occurredpublic static String[] splitFile(String filename) throws Exception
RSConstants.partSizefilename - The file to splitException - An unrecoverable for the operation error occuredpublic static void copy(String src, DataOutputStream dst) throws Exception
src - The source filedst - The destination streamException - An unrecoverable for the operation error occuredpublic static void copy(String src, String dst) throws Exception
src - The source filedst - The destination fileException - An unrecoverable for the operation error occuredpublic static void copy(ResultSet rs, String src, DataOutputStream dst) throws Exception
rs - the RSsrc - The source filedst - The destination fileException - An unrecoverable for the operation error occurredpublic static String persistStream(InputStream content) throws Exception
content - the stream to persistException - an unrecoverable for the operation error occurredpublic static int getNumberOfResultsInTextFile(String filename) throws Exception
filename - The file to retrieve the records fromException - An unrecoverable for the operation error occuredpublic static byte[] getBytesFromFile(File file) throws Exception
file - The File handlerException - in case of errorpublic static void runGC()
Copyright © 2020. All Rights Reserved.