Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
c1d6299a
Commit
c1d6299a
authored
17 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
list all files method
SVN: 2128
parent
9dbc2b25
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
+23
-10
23 additions, 10 deletions
...java/ch/systemsx/cisd/common/utilities/FileUtilities.java
with
23 additions
and
10 deletions
common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
+
23
−
10
View file @
c1d6299a
...
@@ -65,20 +65,20 @@ public final class FileUtilities
...
@@ -65,20 +65,20 @@ public final class FileUtilities
* A file filter that accepts all entries.
* A file filter that accepts all entries.
*/
*/
public
static
final
FileFilter
ACCEPT_ALL_FILTER
=
new
FileFilter
()
public
static
final
FileFilter
ACCEPT_ALL_FILTER
=
new
FileFilter
()
{
public
boolean
accept
(
File
pathname
)
{
{
return
true
;
public
boolean
accept
(
File
pathname
)
}
{
};
return
true
;
}
};
/**
/**
* Copies the content of the specified source file to the specified destination file.
* Copies the content of the specified source file to the specified destination file.
*
*
* @param sourceFile File to be copied.
* @param sourceFile File to be copied.
* @param destinationFile File to whom content of <code>sourceFile</code> is copied.
* @param destinationFile File to whom content of <code>sourceFile</code> is copied.
* @param preservesLastModifiedDate If <code>true</code> the last modified date of <code>sourceFile</code>
* @param preservesLastModifiedDate If <code>true</code> the last modified date of <code>sourceFile</code>
will
*
will
be transfered to <code>destinationFile</code>.
*
be transfered to <code>destinationFile</code>.
* @throws EnvironmentFailureException if a {@link IOException} occured.
* @throws EnvironmentFailureException if a {@link IOException} occured.
*/
*/
public
static
void
copyFileTo
(
File
sourceFile
,
File
destinationFile
,
boolean
preservesLastModifiedDate
)
public
static
void
copyFileTo
(
File
sourceFile
,
File
destinationFile
,
boolean
preservesLastModifiedDate
)
...
@@ -94,7 +94,7 @@ public final class FileUtilities
...
@@ -94,7 +94,7 @@ public final class FileUtilities
}
catch
(
IOException
ex
)
}
catch
(
IOException
ex
)
{
{
throw
new
EnvironmentFailureException
(
"Couldn't copy file '"
+
sourceFile
+
"' to '"
+
destinationFile
throw
new
EnvironmentFailureException
(
"Couldn't copy file '"
+
sourceFile
+
"' to '"
+
destinationFile
+
"'."
,
ex
);
+
"'."
,
ex
);
}
finally
}
finally
{
{
IOUtils
.
closeQuietly
(
inputStream
);
IOUtils
.
closeQuietly
(
inputStream
);
...
@@ -112,7 +112,6 @@ public final class FileUtilities
...
@@ -112,7 +112,6 @@ public final class FileUtilities
}
}
}
}
/**
/**
* Loads a text file to a {@link String}.
* Loads a text file to a {@link String}.
*
*
...
@@ -138,6 +137,7 @@ public final class FileUtilities
...
@@ -138,6 +137,7 @@ public final class FileUtilities
IOUtils
.
closeQuietly
(
fileReader
);
IOUtils
.
closeQuietly
(
fileReader
);
}
}
}
}
/**
/**
* Writes the specified string to the specified file.
* Writes the specified string to the specified file.
*
*
...
@@ -147,7 +147,7 @@ public final class FileUtilities
...
@@ -147,7 +147,7 @@ public final class FileUtilities
{
{
assert
file
!=
null
:
"Unspecified file."
;
assert
file
!=
null
:
"Unspecified file."
;
assert
str
!=
null
:
"Unspecified string."
;
assert
str
!=
null
:
"Unspecified string."
;
FileWriter
fileWriter
=
null
;
FileWriter
fileWriter
=
null
;
try
try
{
{
...
@@ -593,6 +593,19 @@ public final class FileUtilities
...
@@ -593,6 +593,19 @@ public final class FileUtilities
}
}
}
}
/**
* Lists all resources in a given directory.
*
* @param directory the directory to list
* @param loggerOrNull logger, if <code>null</code> than no logging occurs
* @return all files in <var>directory</var> or <code>null</code>, if <var>directory</var> does not exist or is
* not a directory.
*/
public
static
File
[]
tryListFiles
(
File
directory
,
ISimpleLogger
loggerOrNull
)
{
return
tryListFiles
(
directory
,
ACCEPT_ALL_FILTER
,
loggerOrNull
);
}
/**
/**
* Lists all resources in a given directory which match the filter.
* Lists all resources in a given directory which match the filter.
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment