src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WebSocket.java
branchhttp-client-branch
changeset 55929 f00db5921736
parent 55851 0bd10b7df2d2
child 55973 4d9b002587db
equal deleted inserted replaced
55925:81aa2f98ea52 55929:f00db5921736
   516      *         the message
   516      *         the message
   517      * @param isLast
   517      * @param isLast
   518      *         {@code true} if this is the last part of the message,
   518      *         {@code true} if this is the last part of the message,
   519      *         {@code false} otherwise
   519      *         {@code false} otherwise
   520      *
   520      *
   521      * @return a {@code CompletableFuture} that completes, with this {@code
   521      * @return a {@code CompletableFuture} that completes, with this
   522      *         WebSocket}, when the message has been sent
   522      * {@code WebSocket}, when the message has been sent
   523      */
   523      */
   524     CompletableFuture<WebSocket> sendText(CharSequence message, boolean isLast);
   524     CompletableFuture<WebSocket> sendText(CharSequence message, boolean isLast);
   525 
   525 
   526     /**
   526     /**
   527      * Sends a Binary message with bytes from the given {@code ByteBuffer}.
   527      * Sends a Binary message with bytes from the given {@code ByteBuffer}.
   548      *         the message
   548      *         the message
   549      * @param isLast
   549      * @param isLast
   550      *         {@code true} if this is the last part of the message,
   550      *         {@code true} if this is the last part of the message,
   551      *         {@code false} otherwise
   551      *         {@code false} otherwise
   552      *
   552      *
   553      * @return a {@code CompletableFuture} that completes, with this {@code
   553      * @return a {@code CompletableFuture} that completes, with this
   554      *         WebSocket}, when the message has been sent
   554      * {@code WebSocket}, when the message has been sent
   555      */
   555      */
   556     CompletableFuture<WebSocket> sendBinary(ByteBuffer message, boolean isLast);
   556     CompletableFuture<WebSocket> sendBinary(ByteBuffer message, boolean isLast);
   557 
   557 
   558     /**
   558     /**
   559      * Sends a Ping message with bytes from the given {@code ByteBuffer}.
   559      * Sends a Ping message with bytes from the given {@code ByteBuffer}.
   575      * </ul>
   575      * </ul>
   576      *
   576      *
   577      * @param message
   577      * @param message
   578      *         the message
   578      *         the message
   579      *
   579      *
   580      * @return a {@code CompletableFuture} that completes, with this {@code
   580      * @return a {@code CompletableFuture} that completes, with this
   581      *         WebSocket}, when the Ping message has been sent
   581      * {@code WebSocket}, when the Ping message has been sent
   582      */
   582      */
   583     CompletableFuture<WebSocket> sendPing(ByteBuffer message);
   583     CompletableFuture<WebSocket> sendPing(ByteBuffer message);
   584 
   584 
   585     /**
   585     /**
   586      * Sends a Pong message with bytes from the given {@code ByteBuffer}.
   586      * Sends a Pong message with bytes from the given {@code ByteBuffer}.
   587      *
   587      *
   588      * <p> The message consists of not more than {@code 125} bytes from the
   588      * <p> The message consists of not more than {@code 125} bytes from the
   589      * buffer's position to its limit. Upon normal completion of a
   589      * buffer's position to its limit. Upon normal completion of a
   590      * {@code CompletableFuture} returned from this method the buffer will
   590      * {@code CompletableFuture} returned from this method the buffer will have
   591      * have no remaining bytes. The buffer must not be accessed until after that.
   591      * no remaining bytes. The buffer must not be accessed until after that.
   592      *
   592      *
   593      * <p> The {@code CompletableFuture} returned from this method can
   593      * <p> The {@code CompletableFuture} returned from this method can
   594      * complete exceptionally with:
   594      * complete exceptionally with:
   595      * <ul>
   595      * <ul>
   596      * <li> {@link IllegalArgumentException} -
   596      * <li> {@link IllegalArgumentException} -
   602      * </ul>
   602      * </ul>
   603      *
   603      *
   604      * @param message
   604      * @param message
   605      *         the message
   605      *         the message
   606      *
   606      *
   607      * @return a {@code CompletableFuture} that completes, with this {@code
   607      * @return a {@code CompletableFuture} that completes, with this
   608      *         WebSocket}, when the Pong message has been sent
   608      * {@code WebSocket}, when the Pong message has been sent
   609      */
   609      */
   610     CompletableFuture<WebSocket> sendPong(ByteBuffer message);
   610     CompletableFuture<WebSocket> sendPong(ByteBuffer message);
   611 
   611 
   612     /**
   612     /**
   613      * Sends a Close message with the given status code and the reason,
   613      * Sends a Close message with the given status code and the reason,
   646      * @param statusCode
   646      * @param statusCode
   647      *         the status code
   647      *         the status code
   648      * @param reason
   648      * @param reason
   649      *         the reason
   649      *         the reason
   650      *
   650      *
   651      * @return a {@code CompletableFuture} that completes, with this {@code
   651      * @return a {@code CompletableFuture} that completes, with this
   652      *         WebSocket}, when the Close message has been sent
   652      * {@code WebSocket}, when the Close message has been sent
   653      */
   653      */
   654     CompletableFuture<WebSocket> sendClose(int statusCode, String reason);
   654     CompletableFuture<WebSocket> sendClose(int statusCode, String reason);
   655 
   655 
   656     /**
   656     /**
   657      * Requests {@code n} more messages from this {@code WebSocket}.
   657      * Requests {@code n} more messages from this {@code WebSocket}.
   674      * Returns the subprotocol for this {@code WebSocket}.
   674      * Returns the subprotocol for this {@code WebSocket}.
   675      *
   675      *
   676      * <p> This method may be invoked at any time.
   676      * <p> This method may be invoked at any time.
   677      *
   677      *
   678      * @return the subprotocol for this {@code WebSocket}, or an empty
   678      * @return the subprotocol for this {@code WebSocket}, or an empty
   679      *         {@code String} if there's no subprotocol
   679      * {@code String} if there's no subprotocol
   680      */
   680      */
   681     String getSubprotocol();
   681     String getSubprotocol();
   682 
   682 
   683     /**
   683     /**
   684      * Tells whether or not this {@code WebSocket} is permanently closed
   684      * Tells whether or not this {@code WebSocket} is permanently closed