org.netbeans.modules.extexecution/2 1.25.1

org.netbeans.api.extexecution.input
Class InputReaders

java.lang.Object
  extended by org.netbeans.api.extexecution.input.InputReaders

public final class InputReaders
extends Object

Factory methods for InputReader classes.


Nested Class Summary
static class InputReaders.FileInput
          Represents the file with associated charset for reading from it.
 
Method Summary
static InputReader forFile(File file, Charset charset)
          Returns the input reader for the given file.
static InputReader forFileInputProvider(InputReaders.FileInput.Provider fileProvider)
          Returns the input reader reading data from the given provider.
static InputReader forReader(Reader reader)
          Returns the input reader backed by the given reader.
static InputReader forStream(InputStream stream, Charset charset)
          Returns the input reader backed by the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forReader

@NonNull
public static InputReader forReader(@NonNull
                                            Reader reader)
Returns the input reader backed by the given reader.

The client should not use the reader passed as argument anymore. When the returned input reader is closed reader passed as argument is closed respectively.

Returned reader will never call reset on InputProcessor while reading.

Returned reader is not thread safe so it can't be used in multiple instances of InputReaderTask.

Parameters:
reader - real source of the data
Returns:
input reader backed by the given reader

forStream

@NonNull
public static InputReader forStream(@NonNull
                                            InputStream stream,
                                            @NonNull
                                            Charset charset)
Returns the input reader backed by the given stream. To convert read bytes to characters specified charset is used.

The client should not use the stream passed as argument anymore. When the returned input reader is closed stream is closed respectively.

Returned reader will never call reset on InputProcessor while reading.

Returned reader is not thread safe so it can't be used in multiple instances of InputReaderTask.

Parameters:
stream - real source of the data
charset - bytes to characters conversion charset
Returns:
input reader backed by the given stream

forFile

@NonNull
public static InputReader forFile(@NonNull
                                          File file,
                                          @NonNull
                                          Charset charset)
Returns the input reader for the given file. To convert read bytes to characters specified charset is used.

Returned reader will never call reset on InputProcessor while reading.

Returned reader is not thread safe so it can't be used in multiple instances of InputReaderTask.

Parameters:
file - file to read from
charset - bytes to characters conversion charset
Returns:
input reader for the given file

forFileInputProvider

@NonNull
public static InputReader forFileInputProvider(@NonNull
                                                       InputReaders.FileInput.Provider fileProvider)
Returns the input reader reading data from the given provider.

This means that the actual file (and the corresponding charset) used can change during the processing. This is specifically useful for rotating log files.

Before each read cycle reader invokes InputReaders.FileInput.Provider.getFileInput() to determine the actual file to read.

When processing the input InputProcessor.reset() is called on each file change (when provided file input differs from the previous one).

Returned reader is not thread safe so it can't be used in multiple instances of InputReaderTask.

Parameters:
fileProvider - provider used to get the file to process
Returns:
input reader for the given provider

org.netbeans.modules.extexecution/2 1.25.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.