|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.linkedin.util.io.IOUtils
org.linkedin.groovy.util.io.GroovyIOUtils
class GroovyIOUtils extends IOUtils
IO related utilities
Method Summary | |
---|---|
static java.lang.String
|
cat(java.lang.Object location)
Returns the content of the location as a |
static Resource
|
eachChildRecurse(Resource resource, groovy.lang.Closure closure)
The closure will be called for every child (recursively) of the provided resource |
static void
|
eachLine(java.io.Reader reader, groovy.lang.Closure closure)
The difference between |
static void
|
eachLine(java.net.URL url, groovy.lang.Closure closure)
Convenient call which calls {@link #eachLine(Reader, Closure). |
static java.io.File
|
fetchContent(java.lang.Object location, java.io.File destination)
Fetches the file pointed to by the location. |
static java.lang.Object
|
findAll(Resource resource, groovy.lang.Closure closure)
Every child resource of this resource (recursively) is being passed to the closure. |
static boolean
|
isChild(java.io.File parent, java.io.File child)
|
static java.io.File
|
makeRelativeToParent(java.io.File parent, java.io.File child)
Ex: parent=/a/b/c child='/a/b/c/d/e'... would return d/e |
static java.io.File
|
mkdirs(java.io.File dir)
Creates the directory and parents of the provided directory. |
static java.lang.Object
|
safeOverwrite(java.io.File toFile, groovy.lang.Closure closure)
This convenient call takes a file you want to (over)write to and a closure. |
static java.io.File
|
toFile(java.lang.Object s)
returns a file... handles |
Method Detail |
---|
static java.lang.String cat(java.lang.Object location)
String
static Resource eachChildRecurse(Resource resource, groovy.lang.Closure closure)
static void eachLine(java.io.Reader reader, groovy.lang.Closure closure)
reader.eachLine()
and this method is that
as soon as the closure returns false
then the iteration is stopped. There is no
way to stop the iteration with reader.eachLine()
.
static void eachLine(java.net.URL url, groovy.lang.Closure closure)
static java.io.File fetchContent(java.lang.Object location, java.io.File destination)
File
,
a String
or URI
and must contain a scheme. Example of locations:
http://locahost:8080/file.txt'
, file:/tmp/file.txt
,
ivy:/org.linkedin/util-core/1.0.0
.
location
- where is the content you want to retrieve locallydestination
- where to store the content locallydestination
static java.lang.Object findAll(Resource resource, groovy.lang.Closure closure)
true
then it will be part of the result.
static boolean isChild(java.io.File parent, java.io.File child)
true
if child is really a child of parent or in other words if child
is located in a subpath of parent (handle canonical path properly)
static java.io.File makeRelativeToParent(java.io.File parent, java.io.File child)
null
if child is not a child of parent! If child is relative the return child
static java.io.File mkdirs(java.io.File dir)
static java.lang.Object safeOverwrite(java.io.File toFile, groovy.lang.Closure closure)
toFile
- the final file where you want your output to beclosure
- takes a File
as a parameter that you should use
static java.io.File toFile(java.lang.Object s)
File
, URI, URL, string, null
Groovy Documentation