Groovy Documentation

org.linkedin.groovy.util.io
[Groovy] Class GroovyIOUtils

java.lang.Object
  org.linkedin.util.io.IOUtils
      org.linkedin.groovy.util.io.GroovyIOUtils

class GroovyIOUtils
extends IOUtils

IO related utilities

Authors:
ypujante@linkedin.com


Method Summary
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 reader.eachLine() and this method is that as soon as the closure returns false then the iteration is stopped.

static void eachLine(java.net.URL url, groovy.lang.Closure closure)

Convenient call which calls {@link #eachLine(Reader, Closure).

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)

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)

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.io.File toFile(java.lang.Object s)

returns a file... handles File, URI, URL, string, null

 

Method Detail

eachChildRecurse

static Resource eachChildRecurse(Resource resource, groovy.lang.Closure closure)
The closure will be called for every child (recursively) of the provided resource
Returns:
the resource passed it


eachLine

static void eachLine(java.io.Reader reader, groovy.lang.Closure closure)
The difference between 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().


eachLine

static void eachLine(java.net.URL url, groovy.lang.Closure closure)
Convenient call which calls {
link:
#eachLine(Reader, Closure).


findAll

static java.lang.Object findAll(Resource resource, groovy.lang.Closure closure)
Every child resource of this resource (recursively) is being passed to the closure. If the closure returns true then it will be part of the result.


isChild

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)


makeRelativeToParent

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
Returns:
a file object which contains the relative part from the child to the parent. null if child is not a child of parent! If child is relative the return child


mkdirs

static java.io.File mkdirs(java.io.File dir)
Creates the directory and parents of the provided directory. Returns dir.


toFile

static java.io.File toFile(java.lang.Object s)
returns a file... handles File, URI, URL, string, null


 

Groovy Documentation