Package org.jgrapes.webconlet.oidclogin
Class TextCollector
java.lang.Object
org.jgrapes.webconlet.oidclogin.TextCollector
- All Implemented Interfaces:
InputConsumer
Collects character data from buffers and makes it available as
a text.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets the charset to be used iffeed(ManagedBuffer)
is invoked withManagedBuffer<ByteBuffer>
.Configures a consumer for the collected text.boolean
eof()
Checks if more input may become available.<W extends Buffer>
voidfeed
(ManagedBuffer<W> buffer) Feed data to the collector.<W extends Buffer>
voidfeed
(W buffer) Feed data to the collector.maximumSize
(int maximumLength) Configures the maximum length of the collected text.Sets the charset to be used iffeed(ManagedBuffer)
is invoked withManagedBuffer<ByteBuffer>
to the charset specified as system propertynative.encoding
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jgrapes.io.util.InputConsumer
feed
-
Constructor Details
-
TextCollector
public TextCollector()
-
-
Method Details
-
charset
Sets the charset to be used iffeed(ManagedBuffer)
is invoked withManagedBuffer<ByteBuffer>
.Defaults to UTF-8. Must be set before the first invocation of
feed(ManagedBuffer)
.- Parameters:
charset
- the charset- Returns:
- the managed buffer reader
-
nativeCharset
Sets the charset to be used iffeed(ManagedBuffer)
is invoked withManagedBuffer<ByteBuffer>
to the charset specified as system propertynative.encoding
.If this property does not specify a valid charset,
Charset.defaultCharset()
is used.Must be invoked before the first invocation of
feed(ManagedBuffer)
.- Returns:
- the managed buffer reader
-
maximumSize
Configures the maximum length of the collected text.Input exceeding this size will be discarded.
- Parameters:
maximumLength
- the maximum length- Returns:
- the maximum size
-
consumer
Configures a consumer for the collected text.The consumer is invoked once when the complete text is available.
- Parameters:
consumer
- the consumer- Returns:
- the line collector
-
feed
Feed data to the collector.Calling this method with
null
as argument closes the feed.- Parameters:
buffer
- the buffer
-
feed
Feed data to the collector.Calling this method with
null
as argument closes the feed.- Specified by:
feed
in interfaceInputConsumer
- Parameters:
buffer
- the buffer
-
eof
Checks if more input may become available.- Returns:
- true, if successful
-