-
- All Known Subinterfaces:
- Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
public interface Encoder
The Encoder interface defines how developers can provide a way to convert their custom objects into web socket messages. The Encoder interface contains subinterfaces that allow encoding algorithms to encode custom objects to: text, binary data, character stream and write to an output stream. The websocket implementation creates a new instance of the encoder per endpoint instance per connection. This means that each encoder instance has at most one calling thread at a time. The lifecycle of the Encoder instance is governed by the container calls to theinit(javax.websocket.EndpointConfig)
anddestroy()
methods.- Author:
- dannycoward
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interface
Encoder.Binary<T>
This interface defines how to provide a way to convert a custom object into a binary message.static interface
Encoder.BinaryStream<T>
This interface may be implemented by encoding algorithms that want to write the encoded object to a binary stream.static interface
Encoder.Text<T>
This interface defines how to provide a way to convert a custom object into a text message.static interface
Encoder.TextStream<T>
This interface may be implemented by encoding algorithms that want to write the encoded object to a character stream.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
destroy()
This method is called when the encoder is about to be removed from service in order that any resources the encoder used may be closed gracefully.void
init(EndpointConfig config)
This method is called with the endpoint configuration object of the endpoint this encoder is intended for when it is about to be brought into service.
-
-
-
Method Detail
-
init
void init(EndpointConfig config)
This method is called with the endpoint configuration object of the endpoint this encoder is intended for when it is about to be brought into service.- Parameters:
config
- the endpoint configuration object when being brought into service
-
destroy
void destroy()
This method is called when the encoder is about to be removed from service in order that any resources the encoder used may be closed gracefully.
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 19:06:36 Cette version de la page est en cache (à la date du 21/08/2025 19:06:36) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/websocket/encoder.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.