net.sf.staccatocommons.io
Class IOStreams

java.lang.Object
  extended by net.sf.staccatocommons.io.IOStreams

public class IOStreams
extends Object

Class methods for creating Streams that retrieve elements from different IO sources

Author:
flbulgarelli

Method Summary
static Stream<String> fromLines(InputStream in)
          Answers a Stream that retrieves lines from the given InputStream
static Stream<String> fromLines(Reader readable)
          Answers a Stream that retrieves lines from the given Readable
static
<A> Stream<A>
fromObjects(ObjectInput readable)
          Answers a Stream that retrieves objects from the given ObjectInput
static Stream<String> fromTokens(InputStream in, String regexp)
          Answers a Stream that retrieves tokens that match the given regular expression from the given InputStream
static Stream<String> fromTokens(Readable readable, String regexp)
          Answers a Stream that retrieves tokens that match the given regular expression from the given Readable
static Stream<String> fromWords(InputStream in)
          Answers a Stream that retrieves words from the given InputStream
static Stream<String> fromWords(Readable readable)
          Answers a Stream that retrieves words from the given Readable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromWords

@NonNull
public static Stream<String> fromWords(@KeepOpen@NonNull
                                               Readable readable)
Answers a Stream that retrieves words from the given Readable

Parameters:
readable -
Returns:
a new single-iteration Stream

fromWords

@NonNull
public static Stream<String> fromWords(@NonNull
                                               InputStream in)
Answers a Stream that retrieves words from the given InputStream

Parameters:
readable -
Returns:
a new single-iteration Stream

fromLines

@NonNull
public static Stream<String> fromLines(@KeepOpen@NonNull
                                               Reader readable)
Answers a Stream that retrieves lines from the given Readable

Parameters:
readable -
Returns:
a new single-iteration Stream

fromLines

@NonNull
public static Stream<String> fromLines(@KeepOpen@NonNull
                                               InputStream in)
Answers a Stream that retrieves lines from the given InputStream

Parameters:
readable -
Returns:
a new single-iteration Stream

fromTokens

@NonNull
public static Stream<String> fromTokens(@KeepOpen@NonNull
                                                Readable readable,
                                                @NonNull
                                                String regexp)
Answers a Stream that retrieves tokens that match the given regular expression from the given Readable

Parameters:
readable -
regexp -
Returns:
a new single-iteration Stream

fromTokens

@NonNull
public static Stream<String> fromTokens(@KeepOpen@NonNull
                                                InputStream in,
                                                @NonNull
                                                String regexp)
Answers a Stream that retrieves tokens that match the given regular expression from the given InputStream

Parameters:
readable -
regexp -
Returns:
a new single-iteration Stream

fromObjects

@NonNull
public static <A> Stream<A> fromObjects(@KeepOpen@NonNull
                                                ObjectInput readable)
Answers a Stream that retrieves objects from the given ObjectInput

Type Parameters:
A - the type of object to read from the given redable
Parameters:
readable - an ObjectInput that is the source of the returned Stream
Returns:
a new single-iteration Stream


Copyright © 2010-2012 StaccatoCommons. All Rights Reserved.