Package | Description |
---|---|
bayou.async |
Async programming model.
|
bayou.bytes |
Async byte source/sink.
|
bayou.file |
Utilities for files.
|
bayou.form |
Html form handling.
|
bayou.gzip |
GZIP related utils.
|
bayou.http |
Http server.
|
bayou.mime |
MIME related utilities.
|
bayou.ssl |
SSL support.
|
bayou.tcp |
Non-blocking TCP server.
|
bayou.text |
Utilities for texts.
|
bayou.util |
Miscellaneous types and utilities.
|
bayou.websocket |
WebSocket server.
|
Modifier and Type | Interface and Description |
---|---|
interface |
AutoAsync<T>
To make a type also as an `Async` type.
|
Modifier and Type | Class and Description |
---|---|
class |
AsyncBundle<T,R>
Bundles multiple parallel
Async<T> tasks as one Async<R> action. |
class |
Promise<T>
An implementation of `Async` for result producers.
|
Modifier and Type | Field and Description |
---|---|
static Async<Void> |
Async.VOID
A constant
Async<Void> that immediately succeeds with value null . |
Modifier and Type | Method and Description |
---|---|
default <X extends Exception> Async<T> |
Async.catch__(Class<X> exceptionType,
FunctionX<X,Async<T>> exceptionHandler)
If `this` action fails with a specific exception type, invoke an exception handler.
|
default <X extends Exception> Async<T> |
Async.catch_(Class<X> exceptionType,
FunctionX<X,T> exceptionHandler)
If `this` action fails with a specific exception type, invoke an exception handler.
|
default <R> Async<R> |
Async.covary()
Do a covariance cast.
|
static <T> Async<T> |
Async.execute(Callable<T> action)
Execute the action asynchronously in a default executor.
|
static <T> Async<T> |
Async.execute(ExecutorService executor,
Callable<T> action)
Execute the action asynchronously, return an Async that completes when the action completes.
|
static <T> Async<T> |
Async.failure(Exception e)
Create an `Async<T>` that immediately fails with `e`.
|
default Async<T> |
Async.finally_(Callable<Async<?>> action)
After `this` action completes, regardless of success or failure, execute a subsequent action.
|
default Async<T> |
Async.finally_(RunnableX action)
After `this` action completes, regardless of success or failure, execute a subsequent action.
|
static <T> Async<Void> |
AsyncIterator.forEach_(AsyncIterator<T> elements,
FunctionX<T,Async<?>> asyncAction)
Perform asyncAction on each element.
|
default Async<Void> |
AsyncIterator.forEach_(FunctionX<T,Async<?>> asyncAction)
Similar to
forEach() , except that the action is async. |
static <T> Async<Void> |
AsyncIterator.forEach(AsyncIterator<T> elements,
ConsumerX<T> action)
Perform action on each element.
|
default Async<Void> |
AsyncIterator.forEach(ConsumerX<T> action)
Perform action on each element.
|
static <T1,T2,R> Async<R> |
Async.invoke_(BiFunctionX<T1,T2,Async<R>> func,
Async<T1> async1,
Async<T2> async2)
Similar to
invoke(bayou.util.function.BiFunctionX, Async, Async) ,
except that `func` returns `Async<R>` instead. |
static <T1,T2,R> Async<R> |
Async.invoke(BiFunctionX<T1,T2,R> func,
Async<T1> async1,
Async<T2> async2)
Invoke `func` with async args.
|
Async<T> |
Fiber.join()
Return an Async that completes when this fiber completes.
|
default <R> Async<R> |
Async.map(FunctionX<T,R> onSuccess)
After `this` action succeeds, map the value to another value.
|
default <R> Async<R> |
Async.map(FunctionX<T,R> onSuccess,
FunctionX<Exception,R> onFailure)
After `this` action completes, map the success value or the failure exception to another value.
|
Async<T> |
AsyncIterator.next()
Yield the next element asynchronously.
|
default Async<T> |
Async.peek(ConsumerX<T> onSuccess)
After `this` action succeeds, perform an action on the value.
|
default Async<T> |
Async.peek(ConsumerX<T> onSuccess,
ConsumerX<Exception> onFailure)
After `this` action completes, perform an action on the result.
|
default <R> Async<R> |
AsyncIterator.reduce_(R r0,
BiFunctionX<R,T,Async<R>> func)
Similar to
reduce() , except func returns Async<R> instead of R. |
default <R> Async<R> |
AsyncIterator.reduce(R r0,
BiFunctionX<R,T,R> func)
Compute a value from the elements.
|
static Async<Void> |
Fiber.sleep(Duration duration)
Start an async action that idles for the specified duration, then succeeds with `null`.
|
static <T> Async<T> |
Fiber.sleep(Duration duration,
T value)
Start an async action that idles for the specified duration, then succeeds with `value`.
|
static <T> Async<T> |
Async.success(T value)
Create an `Async<T>` that immediately succeeds with `value`.
|
default <R> Async<R> |
Async.then(FunctionX<T,Async<R>> onSuccess)
After `this` action succeeds, invoke a subsequent action.
|
default <R> Async<R> |
Async.then(FunctionX<T,Async<R>> onSuccess,
FunctionX<Exception,Async<R>> onFailure)
After `this` action completes, invoke a subsequence action.
|
default Async<T> |
AutoAsync.timeout(Duration duration)
Implements
timeout(Duration) ;
by default, do nothing. |
default Async<T> |
Async.timeout(Duration duration)
Fail this action with
TimeoutException
if it's not completed within the specific duration. |
default Async<List<T>> |
AsyncIterator.toList()
Gather all elements into a List.
|
default <R> Async<R> |
Async.transform(FunctionX<Result<T>,Async<R>> func)
After `this` action completes, invoke a function to transform the result.
|
Modifier and Type | Method and Description |
---|---|
static <T1,T2,R> Async<R> |
Async.invoke_(BiFunctionX<T1,T2,Async<R>> func,
Async<T1> async1,
Async<T2> async2)
Similar to
invoke(bayou.util.function.BiFunctionX, Async, Async) ,
except that `func` returns `Async<R>` instead. |
static <T1,T2,R> Async<R> |
Async.invoke_(BiFunctionX<T1,T2,Async<R>> func,
Async<T1> async1,
Async<T2> async2)
Similar to
invoke(bayou.util.function.BiFunctionX, Async, Async) ,
except that `func` returns `Async<R>` instead. |
static <T1,T2,R> Async<R> |
Async.invoke(BiFunctionX<T1,T2,R> func,
Async<T1> async1,
Async<T2> async2)
Invoke `func` with async args.
|
static <T1,T2,R> Async<R> |
Async.invoke(BiFunctionX<T1,T2,R> func,
Async<T1> async1,
Async<T2> async2)
Invoke `func` with async args.
|
Modifier and Type | Method and Description |
---|---|
static <T> AsyncBundle<T,List<T>> |
AsyncBundle.allOf(Stream<Async<T>> tasks)
Create a bundle that succeeds if all of the tasks succeeds.
|
static <T> AsyncBundle<T,T> |
AsyncBundle.anyOf(Stream<Async<T>> tasks)
Create a bundle that succeeds as soon as any one of the tasks succeeds.
|
default <X extends Exception> Async<T> |
Async.catch__(Class<X> exceptionType,
FunctionX<X,Async<T>> exceptionHandler)
If `this` action fails with a specific exception type, invoke an exception handler.
|
default AsyncIterator<T> |
AsyncIterator.filter_(FunctionX<T,Async<Boolean>> predicate)
Similar to
filter() , except that predicate returns Async<Boolean> instead of Boolean. |
default Async<T> |
Async.finally_(Callable<Async<?>> action)
After `this` action completes, regardless of success or failure, execute a subsequent action.
|
static <T> Async<Void> |
AsyncIterator.forEach_(AsyncIterator<T> elements,
FunctionX<T,Async<?>> asyncAction)
Perform asyncAction on each element.
|
default Async<Void> |
AsyncIterator.forEach_(FunctionX<T,Async<?>> asyncAction)
Similar to
forEach() , except that the action is async. |
static <T1,T2,R> Async<R> |
Async.invoke_(BiFunctionX<T1,T2,Async<R>> func,
Async<T1> async1,
Async<T2> async2)
Similar to
invoke(bayou.util.function.BiFunctionX, Async, Async) ,
except that `func` returns `Async<R>` instead. |
default <R> AsyncIterator<R> |
AsyncIterator.map_(FunctionX<T,Async<R>> func)
Similar to
map() , except that `func` returns Async<R> instead of R. |
default <R> Async<R> |
AsyncIterator.reduce_(R r0,
BiFunctionX<R,T,Async<R>> func)
Similar to
reduce() , except func returns Async<R> instead of R. |
static <T> AsyncBundle<T,List<T>> |
AsyncBundle.someOf(Stream<Async<T>> tasks,
int successThreshold)
Create a bundle that succeeds as soon as a number of the tasks succeeds.
|
default <R> Async<R> |
Async.then(FunctionX<T,Async<R>> onSuccess)
After `this` action succeeds, invoke a subsequent action.
|
default <R> Async<R> |
Async.then(FunctionX<T,Async<R>> onSuccess,
FunctionX<Exception,Async<R>> onFailure)
After `this` action completes, invoke a subsequence action.
|
default <R> Async<R> |
Async.then(FunctionX<T,Async<R>> onSuccess,
FunctionX<Exception,Async<R>> onFailure)
After `this` action completes, invoke a subsequence action.
|
default <R> Async<R> |
Async.transform(FunctionX<Result<T>,Async<R>> func)
After `this` action completes, invoke a function to transform the result.
|
Constructor and Description |
---|
AsyncBundle(Stream<Async<T>> tasks,
FunctionX<List<Result<T>>,R> trigger)
Create a bundle over the tasks, with the trigger function.
|
Fiber(Callable<Async<T>> task)
Create a new fiber for the task, with the current executor and a generated name.
|
Fiber(Executor executor,
String name,
Callable<Async<T>> task)
Create a new fiber, with the specified executor, name, and task.
|
Modifier and Type | Method and Description |
---|---|
default Async<String> |
ByteSource.asString(int maxChars)
Read all bytes from this source and convert them to a String.
|
default Async<String> |
ByteSource.asString(int maxChars,
Charset charset)
Read all bytes from this source and convert them to a String.
|
Async<Void> |
ThrottledByteSource.close()
Close this source.
|
Async<Void> |
ThreadSafeByteSource.close()
Close this source.
|
Async<Void> |
SimpleByteSource.close()
Close this source.
|
Async<Void> |
RangedByteSource.close()
Close this source.
|
Async<Void> |
PushbackByteSource.close()
Close this source.
|
Async<Void> |
InputStream2ByteSource.close()
Close this source.
|
Async<Void> |
ByteSource.close()
Close this source.
|
Async<Void> |
ByteSink.close()
Close this sink.
|
Async<Void> |
ByteSink.error(Exception error)
Set this sink to an error state.
|
Async<ByteBuffer> |
ThrottledByteSource.read()
Read the next chunk of bytes.
|
Async<ByteBuffer> |
ThreadSafeByteSource.read()
Read the next chunk of bytes.
|
Async<ByteBuffer> |
SimpleByteSource.read()
Read the next chunk of bytes.
|
Async<ByteBuffer> |
RangedByteSource.read()
Read the next chunk of bytes.
|
Async<ByteBuffer> |
PushbackByteSource.read()
Read the next chunk of bytes.
|
Async<ByteBuffer> |
InputStream2ByteSource.read()
Read the next chunk of bytes.
|
Async<ByteBuffer> |
ByteSource.read()
Read the next chunk of bytes.
|
default Async<ByteBuffer> |
ByteSource.readAll(int maxBytes)
Read all bytes from this source into one ByteBuffer.
|
default Async<Long> |
ByteSource.toSink(ByteSink sink)
Write the bytes from this source to the sink.
|
Async<Void> |
ByteSink.write(ByteBuffer bb)
Write the bytes to this sink.
|
Modifier and Type | Method and Description |
---|---|
Async<Void> |
FileByteSource.close()
Close this source.
|
Async<Void> |
FileByteSink.close() |
Async<Void> |
FileByteSink.error(Exception error) |
Async<AsynchronousFileChannel> |
FileByteSource.ChannelProvider.openChannel()
Open a file channel.
|
Async<ByteBuffer> |
FileByteSource.read()
Read the next chunk of bytes.
|
Async<Void> |
FileByteSink.write(ByteBuffer bb) |
Modifier and Type | Method and Description |
---|---|
Async<FormData> |
FormParser.parse(HttpRequest request)
Parse the request for POST form data.
|
static Async<FormData> |
FormData.parse(HttpRequest request)
Parse the request for POST form data.
|
Modifier and Type | Method and Description |
---|---|
Async<Void> |
GzipByteSource.close() |
Async<Void> |
GunzipByteSource.close() |
Async<ByteBuffer> |
GzipByteSource.read() |
Async<ByteBuffer> |
GunzipByteSource.read()
Read the next chunk of decompressed bytes.
|
Modifier and Type | Class and Description |
---|---|
class |
HttpResponseImpl
A mutable implementation of HttpResponse.
|
Modifier and Type | Method and Description |
---|---|
default Async<ByteBuffer> |
HttpResponse.bodyBytes(int maxBytes)
Get all the bytes of the entity body.
|
default Async<ByteBuffer> |
HttpEntity.bodyBytes(int maxBytes)
Get all the bytes of the body.
|
default Async<String> |
HttpResponse.bodyString(int maxChars)
Get the entity body as a String.
|
default Async<String> |
HttpEntity.bodyString(int maxChars)
Get the body as a String.
|
Async<Void> |
HttpClientConnection.close()
Close the connection and free resources.
|
Async<Void> |
HttpClient.close()
Close this client and free resources.
|
Async<HttpResponse> |
HttpClient.doGet(String absoluteUri)
Send a GET request.
|
static Async<HttpResponse> |
HttpResponse.file(int statusCode,
String filePath)
Create a response serving the file.
|
Async<List<Cookie>> |
CookieStorage.getCookies(HttpRequest request)
Get the cookies that should be sent with the request.
|
Async<HttpResponse> |
HttpHandler.handle(HttpRequest request)
Generate a response for the request.
|
Async<HttpResponse> |
HotHttpHandler.handle(HttpRequest request)
Handle an http request.
|
Async<HttpClientConnection> |
HttpClient.newConnection(TcpAddress dest)
Create a new HTTP connection to `dest` address.
|
Async<HttpResponse> |
HttpClientConnection.receive()
Receive the next non-1xx response.
|
Async<HttpResponse> |
HttpClientConnection.receive0()
Receive the next response, which could be 1xx.
|
Async<Void> |
HttpClientConnection.send(HttpRequest request)
Send a request over this connection.
|
Async<HttpResponse> |
HttpClient.send(HttpRequest request)
Send a request and wait for the final response.
|
Async<HttpResponse> |
HttpClient.send0(HttpRequest request,
TcpAddress dest)
Send a request to `dest`.
|
Async<Void> |
CookieStorage.setCookies(HttpRequest request,
HttpResponse response)
Save the cookies carried in the response.
|
Async<HttpResponse> |
HttpUpgrader.tryUpgrade(HttpRequest httpRequest,
TcpConnection tcpConnection)
Try to upgrade the http connection.
|
Async<TcpConnection> |
ConnectTunnel.tunnelTo(TcpConnection tcpConn,
String host,
int port) |
Modifier and Type | Method and Description |
---|---|
Function<TcpAddress,Async<UserPass>> |
HttpClientConf.get_userPassSupplier() |
Supplier<Async<UserPass>> |
HttpProxy.userPassSupplier()
The username/password supplier for proxy authentication.
|
Modifier and Type | Method and Description |
---|---|
HttpClientConf |
HttpClientConf.userPassSupplier(Function<TcpAddress,Async<UserPass>> userPassSupplier)
Username/password supplier for server authentications.
|
Constructor and Description |
---|
ConnectTunnel(TcpAddress address,
Supplier<Async<UserPass>> userPassSupplier)
Create an HTTP CONNECT tunnel.
|
HttpProxy(TcpAddress address,
Supplier<Async<UserPass>> userPassSupplier)
Create an HttpProxy.
|
Modifier and Type | Method and Description |
---|---|
Async<Void> |
MultipartByteSource.close() |
Async<MultipartPart> |
MultipartParser.getNextPart()
Get the next part.
|
Async<ByteBuffer> |
MultipartByteSource.read() |
Modifier and Type | Method and Description |
---|---|
Async<SslConnection> |
SslChannel2Connection.convert(TcpChannel channel)
Convert a TcpChannel to an SslConnection.
|
Async<TcpConnection> |
SslChannel2Connection.convert(TcpChannel channel,
TcpChannel2Connection plainConverter)
Convert a server-side TcpChannel to SslConnection or plain TcpConnection.
|
Modifier and Type | Method and Description |
---|---|
Async<Void> |
TcpConnection.awaitReadable(boolean accepting)
Wait till this connection becomes readable.
|
Async<Void> |
TcpChannel.awaitReadable(boolean accepting)
Wait till this channel becomes readable.
|
Async<Void> |
TcpConnection.awaitWritable()
Wait till this connection becomes writable.
|
Async<Void> |
TcpChannel.awaitWritable()
Wait till this channel becomes writable.
|
Async<Void> |
TcpConnection.close(Duration drainTimeout)
Close this connection.
|
Async<TcpChannel> |
TcpClient.connect(String peerHost,
InetAddress ip,
int port)
Connect to a remote server.
|
Async<TcpConnection> |
TcpTunnel.tunnelTo(TcpConnection connection,
String host,
int port)
Tunnel to the remote host:port.
|
Async<TcpConnection> |
Socks5Tunnel.tunnelTo(TcpConnection tcpConn,
String host,
int port) |
Constructor and Description |
---|
Socks5Tunnel(TcpAddress address,
boolean remoteDns,
Supplier<Async<UserPass>> userPassSupplier)
Create a SOCKS5 tunnel.
|
Modifier and Type | Method and Description |
---|---|
Async<Void> |
TextByteSource.close() |
Async<ByteBuffer> |
TextByteSource.read() |
Modifier and Type | Interface and Description |
---|---|
interface |
Result<T>
The result of an action,
which is either a success or a failure.
|
Modifier and Type | Method and Description |
---|---|
static <T> Async<T> |
End.async()
Return an `Async<T>` that immediately fails with an
End exception. |
Modifier and Type | Class and Description |
---|---|
static class |
WebSocketResponse.Accept
To accept the handshake.
|
static class |
WebSocketResponse.Reject
To reject the handshake.
|
Modifier and Type | Method and Description |
---|---|
Async<Void> |
WebSocketChannel.close()
Close the channel.
|
Async<WebSocketResponse> |
WebSocketHandler.handle(WebSocketRequest request)
Handle a WebSocket handshake request.
|
Async<WebSocketResponse> |
HotWebSocketHandler.handle(WebSocketRequest request)
Handle a WebSocket request.
|
default Async<ByteBuffer> |
WebSocketChannel.readBinary(int maxBytes)
Read the next binary message into one ByteBuffer.
|
Async<WebSocketMessage> |
WebSocketChannel.readMessage()
Read the next message from the peer.
|
default Async<String> |
WebSocketChannel.readText(int maxChars)
Read the next text message as one String.
|
default Async<Long> |
WebSocketChannel.writeBinary(byte[] bytes)
Write a binary message to the peer.
|
Async<Void> |
WebSocketChannel.writeClose()
Close the outbound gracefully.
|
Async<Long> |
WebSocketChannel.writeMessage(WebSocketMessage message)
Write a message to the peer.
|
default Async<Long> |
WebSocketChannel.writeText(CharSequence chars)
Write a text message to the peer.
|
Modifier and Type | Method and Description |
---|---|
FunctionX<WebSocketChannel,Async<?>> |
WebSocketResponse.Accept.getChannelHandler()
The channelHandler.
|
Modifier and Type | Method and Description |
---|---|
static WebSocketResponse.Accept |
WebSocketResponse.accept(FunctionX<WebSocketChannel,Async<?>> channelHandler)
Create an Accept response.
|
Constructor and Description |
---|
Accept(String subprotocol,
FunctionX<WebSocketChannel,Async<?>> channelHandler)
Create an Accept response.
|