org.geotoolkit.io
Class LineReaders

Object
  extended by Static
      extended by LineReaders

public final class LineReaders
extends Static

Provides implementations of LineReader.

Since:
3.02
Version:
3.19
Author:
Martin Desruisseaux (Geomatys)
Module:
utility/geotk-utility (download)    View source code for this class

Method Summary
static LineReader wrap(DataInput input)
          Wraps the given DataInput in a LineReader.
static LineReader wrap(Iterable<?> collection)
          Wraps the given collection in a LineReader.
static LineReader wrap(Reader reader)
          Wraps the given Reader in a LineReader.
static LineReader wrap(String text)
          Wraps the given multi-lines text in a LineReader.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrap

public static LineReader wrap(String text)
Wraps the given multi-lines text in a LineReader. Each occurrence of '\r', '\n' or "\r\n" in the text mark an End Of Line (EOL).

Parameters:
text - The multi-lines text to wrap.
Returns:
A line reader for each line in the given text.

wrap

public static LineReader wrap(Iterable<?> collection)
Wraps the given collection in a LineReader. Each element will be converted to a line by a call to Object.toString(). Null elements are not allowed.

If the Iterator implements the Closeable interface, then the LineReader.close() method will delegate to Iterator.close().

If any RuntimeException is thrown during the iteration and the exception cause is an instance of IOException, then the IOException is unwrapped and rethrown by the LineReader.readLine() method.

Parameters:
collection - The collection to wrap.
Returns:
A line reader for each element in the given string.

wrap

public static LineReader wrap(DataInput input)
Wraps the given DataInput in a LineReader. If the given input is already a LineReader, then it is returned unchanged.

If the DataInput implements the Closeable interface, then the LineReader.close() method will delegate to DataInput.close().

Parameters:
input - The input to wrap.
Returns:
The wrapped input.

wrap

public static LineReader wrap(Reader reader)
Wraps the given Reader in a LineReader. If the given reader is already a LineReader, then it is returned unchanged.

Parameters:
reader - The reader to wrap.
Returns:
The wrapped reader.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.