Class PushStream
java.lang.Object
org.apache.sling.scripting.sightly.impl.compiler.PushStream
- All Implemented Interfaces:
CommandStream
A stream that can be written into.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addHandler
(CommandHandler handler) Registers a listeningCommandHandler
to the stream.void
close()
Closes this stream.Returns theList
of commands that were written into this stream.void
signalError
(String message) Signal an error to the attachedCommandHandler
.void
warn
(PushStream.StreamMessage warning) void
-
Constructor Details
-
PushStream
public PushStream()
-
-
Method Details
-
addHandler
Description copied from interface:CommandStream
Registers a listeningCommandHandler
to the stream. TheCommandHandler
will be notified for every newCommand
pushed to this stream.- Specified by:
addHandler
in interfaceCommandStream
- Parameters:
handler
- the handler to attach to this stream
-
getCommands
Description copied from interface:CommandStream
Returns theList
of commands that were written into this stream.- Specified by:
getCommands
in interfaceCommandStream
- Returns:
- the commands written into this stream
-
getWarnings
-
write
-
signalError
Signal an error to the attachedCommandHandler
.- Parameters:
message
- the error message- Throws:
UnsupportedOperationException
- if the stream has been closed
-
close
public void close()Closes this stream. Once the stream has been closed no other methods can be called on the stream any more.- Throws:
UnsupportedOperationException
- if the stream has already been closed
-
warn
-