PSEK-Fitnesse-Fixtures
2.3.x (JDK11)
|
A fixture that can be used to generate a (temporary) file, write and read to files and copy files (including over SMB) More...
Classes | |
class | DirFilenameFilter |
Ik ben een FilenameFilter die op basis van een bestandsnaam pattern kan gebruikt worden. More... | |
Public Member Functions | |
FileUtils () | |
Default constructor. More... | |
void | copyFile (String sourceFile, String destinationFile) |
Copies a file from source to target. More... | |
void | copyFileToSMBShare (String sourceFile, String destinationFile, String domain, String domainUsername, String domainPassword) |
Copy file to smb share. More... | |
void | deleteFile (String filename) |
Delete een file als deze bestaat. More... | |
long | getFileSize (String location) |
Gets file size. More... | |
boolean | verifyFileExists (String location) |
Verifies that a file exists. More... | |
boolean | verifySMBFileExists (String location, String domain, String domainUser, String domainPassword) |
Verify smb file exists boolean. More... | |
Static Public Member Functions | |
static boolean | copyFileTo (File sourceFile, File destinationFile) throws IOException |
Ik kopieer een bestand van bron naar bestemming. More... | |
static String | createBinaryTempFile (String filenamePrefix, String filenameSuffix, byte[] filecontents) |
Creates a temporary binary file. More... | |
static void | createFile (File file) throws IOException |
Ik maak een nieuw bestand aan als deze nog niet bestaat. More... | |
static String | createTempFile (String filenamePrefix, String filenameSuffix, String filecontents) |
Creates a temporary UTF-8 file. More... | |
static File | file (String filename) |
File file. More... | |
static List< File > | fileSearch (File directory, boolean deepSearch, FileEvaluator fileEvaluator, FilenameFilter filter) throws IOException |
Ik stel een array van. More... | |
static List< File > | fileSearch (File[] fileArray, FileEvaluator fileEvaluator) throws IOException |
Ik zoek een. More... | |
static List< File > | filesInFolder (File dir, String regexFilePattern) throws IOException |
Files in folder list. More... | |
static List< File > | filesInFolder (String directory, String regexFilePattern) throws IOException |
Files in folder list. More... | |
static int | getDatePart (Date date, int calendarPart) |
Gets date part. More... | |
static String | readFile (final String fileName, final String encoding) throws IOException |
Read file string. More... | |
static List< String > | readLinesInFile (String filename) throws IOException |
Read lines in file list. More... | |
static String | readTextFile (String filename) throws IOException |
Ik lees zoek een bestand op het filesysteem en probeer deze als tekstbestand te lezen. More... | |
static String | readTextFileAsUtf8 (String filename) throws IOException |
Ik lees zoek een bestand op het filesysteem en probeer deze als tekstbestand met UTF-8 encoding te lezen. More... | |
static StreamSource[] | streamSources (String[] bestandsNamen) throws IOException |
Stream sources stream source [ ]. More... | |
static void | writeLineToTextFile (String filename, String textLineToAppend) throws IOException |
Write line to text file. More... | |
static void | writeLineToTextFile (String filename, String textLineToAppend, boolean append) |
Write line to text file. More... | |
static boolean | writeStreamToFile (InputStream inputStream, File file) throws IOException |
Write stream to file boolean. More... | |
Static Public Attributes | |
static final char | CR = '\r' |
The constant CR. More... | |
static final char | LF = '\n' |
The constant LF. More... | |
Static Package Attributes | |
static Path | tempDirWithPrefix |
The Temp dir with prefix. More... | |
Static Private Member Functions | |
static String | chomp (String str) |
Remove the last line separator from the input string. More... | |
static Path | find (final String fileName) |
static boolean | isEmpty (String str) |
Checks for empty. More... | |
static File[] | recursiveDirectoryList (File dir, FilenameFilter filter) throws IOException |
Static Private Attributes | |
static Log | logger = LogFactory.getLog(nl.psek.fitnesse.fixtures.general.util.FileUtils.class) |
A fixture that can be used to generate a (temporary) file, write and read to files and copy files (including over SMB)
Definition at line 28 of file FileUtils.java.
nl.psek.fitnesse.fixtures.general.util.FileUtils.FileUtils | ( | ) |
Default constructor.
Definition at line 48 of file FileUtils.java.
|
staticprivate |
Remove the last line separator from the input string.
str | input string |
Definition at line 575 of file FileUtils.java.
void nl.psek.fitnesse.fixtures.general.util.FileUtils.copyFile | ( | String | sourceFile, |
String | destinationFile | ||
) |
Copies a file from source to target.
sourceFile | the source file |
destinationFile | the destination file |
Definition at line 178 of file FileUtils.java.
|
static |
Ik kopieer een bestand van bron naar bestemming.
sourceFile | the source file |
destinationFile | the destination file |
IOException | the io exception |
Definition at line 405 of file FileUtils.java.
void nl.psek.fitnesse.fixtures.general.util.FileUtils.copyFileToSMBShare | ( | String | sourceFile, |
String | destinationFile, | ||
String | domain, | ||
String | domainUsername, | ||
String | domainPassword | ||
) |
Copy file to smb share.
sourceFile | the source file |
destinationFile | the destination file |
domain | the domain |
domainUsername | the domain username |
domainPassword | the domain password |
Definition at line 198 of file FileUtils.java.
|
static |
Creates a temporary binary file.
filenamePrefix | filename part added to the beginning of the name of the temporary file |
filenameSuffix | filename part added to the end of the name of the temporary file |
filecontents | byte[] content to be written as a file |
StopTestCommandException | if an IOException occurs |
Definition at line 104 of file FileUtils.java.
|
static |
Ik maak een nieuw bestand aan als deze nog niet bestaat.
file | the file |
IOException | the io exception |
Definition at line 439 of file FileUtils.java.
|
static |
Creates a temporary UTF-8 file.
filenamePrefix | filename part added to the beginning of the name of the temporary file |
filenameSuffix | filename part added to the end of the name of the temporary file |
filecontents | String content to be written as a file |
StopTestCommandException | if an IOException occurs |
Definition at line 71 of file FileUtils.java.
void nl.psek.fitnesse.fixtures.general.util.FileUtils.deleteFile | ( | String | filename | ) |
Delete een file als deze bestaat.
filename | the filename |
Definition at line 454 of file FileUtils.java.
|
static |
File file.
filename | the filename |
Definition at line 58 of file FileUtils.java.
|
static |
Ik stel een array van.
samen met bestanden in de opgegeven directory. Als er een deepSearch wordt gedaan doe ik dit recursief voor subdirectories. De totale platgeslagen array met File's geef ik vervolgens mee aan de fileSearch() methode, en geef het resultaat daarvan weer terug.
directory | the directory |
deepSearch | the deep search |
fileEvaluator | the file evaluator |
filter | the filter |
IOException | the io exception |
Definition at line 489 of file FileUtils.java.
|
static |
Ik zoek een.
in een
array. Dit doe ik door de meegeleverde FileEvaluator te voorzien van een File uit de array en vervolgens de valid() methode op de evaluator aan te roepen. vervolgens met zoeken.
fileArray | the file array |
fileEvaluator | the file evaluator |
IOException | the io exception |
Definition at line 528 of file FileUtils.java.
|
static |
Files in folder list.
dir | the dir |
regexFilePattern | the regex file pattern |
IOException | the io exception |
Definition at line 351 of file FileUtils.java.
|
static |
Files in folder list.
directory | the directory |
regexFilePattern | the regex file pattern |
IOException | the io exception |
Definition at line 368 of file FileUtils.java.
|
staticprivate |
Definition at line 555 of file FileUtils.java.
|
static |
Gets date part.
date | the date |
calendarPart | the calendar part |
Definition at line 470 of file FileUtils.java.
long nl.psek.fitnesse.fixtures.general.util.FileUtils.getFileSize | ( | String | location | ) |
Gets file size.
location | the location |
Definition at line 163 of file FileUtils.java.
|
staticprivate |
Checks for empty.
str | input string |
Definition at line 607 of file FileUtils.java.
|
static |
Read file string.
fileName | the file name |
encoding | the encoding |
IOException | the io exception |
Definition at line 549 of file FileUtils.java.
|
static |
Read lines in file list.
filename | the filename |
IOException | the io exception |
Definition at line 311 of file FileUtils.java.
|
static |
Ik lees zoek een bestand op het filesysteem en probeer deze als tekstbestand te lezen.
Vervolgens geef ik de gelezen tekst als String terug.
Ik verwijder de laatste line separator uit de teruggegeven string
filename | the filename |
IOException | the io exception |
Definition at line 227 of file FileUtils.java.
|
static |
Ik lees zoek een bestand op het filesysteem en probeer deze als tekstbestand met UTF-8 encoding te lezen.
Vervolgens geef ik de gelezen tekst als String terug.
Ik verwijder de laatste line separator uit de teruggegeven string
filename | the filename |
IOException | the io exception |
Definition at line 251 of file FileUtils.java.
|
staticprivate |
Definition at line 504 of file FileUtils.java.
|
static |
Stream sources stream source [ ].
bestandsNamen | the bestands namen |
IOException | the io exception |
Definition at line 330 of file FileUtils.java.
boolean nl.psek.fitnesse.fixtures.general.util.FileUtils.verifyFileExists | ( | String | location | ) |
Verifies that a file exists.
location | the location |
Definition at line 130 of file FileUtils.java.
boolean nl.psek.fitnesse.fixtures.general.util.FileUtils.verifySMBFileExists | ( | String | location, |
String | domain, | ||
String | domainUser, | ||
String | domainPassword | ||
) |
Verify smb file exists boolean.
location | the location |
domain | the domain |
domainUser | the domain user |
domainPassword | the domain password |
Definition at line 144 of file FileUtils.java.
|
static |
Write line to text file.
filename | the filename |
textLineToAppend | the text line to append |
IOException | the io exception |
Definition at line 271 of file FileUtils.java.
|
static |
Write line to text file.
filename | the filename |
textLineToAppend | the text line to append |
append | boolean toggle to append to the file (append=true) or to overwrite (append=false) |
Definition at line 282 of file FileUtils.java.
|
static |
Write stream to file boolean.
inputStream | the input stream |
file | the file |
IOException | the io exception |
Definition at line 421 of file FileUtils.java.
|
static |
The constant CR.
Definition at line 38 of file FileUtils.java.
|
static |
The constant LF.
Definition at line 34 of file FileUtils.java.
|
staticprivate |
Definition at line 30 of file FileUtils.java.
|
staticpackage |
The Temp dir with prefix.
Definition at line 43 of file FileUtils.java.