org.glassfish.tyrus
Class NoOpBinaryCoder

java.lang.Object
  extended by org.glassfish.tyrus.NoOpBinaryCoder
All Implemented Interfaces:
Decoder, Decoder.Binary<ByteBuffer>, Encoder, Encoder.Binary<ByteBuffer>

public class NoOpBinaryCoder
extends Object
implements Decoder.Binary<ByteBuffer>, Encoder.Binary<ByteBuffer>

Author:
Stepan Kopriva (stepan.kopriva at oracle.com)

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.websocket.Decoder
Decoder.Binary<T>, Decoder.BinaryStream<T>, Decoder.Text<T>, Decoder.TextStream<T>
 
Nested classes/interfaces inherited from interface javax.websocket.Encoder
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
 
Field Summary
static NoOpBinaryCoder INSTANCE
           
 
Constructor Summary
NoOpBinaryCoder()
           
 
Method Summary
 ByteBuffer decode(ByteBuffer bytes)
          Decode the given bytes into an object of type T.
 ByteBuffer encode(ByteBuffer object)
          Encode the given object into a byte array.
 boolean willDecode(ByteBuffer bytes)
          Answer whether the given bytes can be decoded into an object of type T.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final NoOpBinaryCoder INSTANCE
Constructor Detail

NoOpBinaryCoder

public NoOpBinaryCoder()
Method Detail

willDecode

public boolean willDecode(ByteBuffer bytes)
Description copied from interface: Decoder.Binary
Answer whether the given bytes can be decoded into an object of type T.

Specified by:
willDecode in interface Decoder.Binary<ByteBuffer>
Parameters:
bytes - the bytes to be decoded.
Returns:
whether or not the bytes can be decoded by this decoder.

decode

public ByteBuffer decode(ByteBuffer bytes)
                  throws DecodeException
Description copied from interface: Decoder.Binary
Decode the given bytes into an object of type T.

Specified by:
decode in interface Decoder.Binary<ByteBuffer>
Parameters:
bytes - the bytes to be decoded.
Returns:
the decoded object
Throws:
DecodeException

encode

public ByteBuffer encode(ByteBuffer object)
                  throws EncodeException
Description copied from interface: Encoder.Binary
Encode the given object into a byte array.

Specified by:
encode in interface Encoder.Binary<ByteBuffer>
Parameters:
object - the object being encoded
Returns:
the binary data
Throws:
EncodeException


Copyright © 2012. All Rights Reserved.