Package javax.websocket

Examples of javax.websocket.DecodeException


            Short result;

            try {
                result = Short.valueOf(s);
            } catch (Exception e) {
                throw new DecodeException(s, "Decoding failed", e);
            }

            return result;        }
View Full Code Here


        }

        @Override
        public EncodableObject decode(final String s) throws DecodeException {
            if(!initalized) {
                throw new DecodeException(s, "not initialized");
            }
            return new EncodableObject(s);
        }
View Full Code Here

    private Object decodePrimitive(final Class<?> targetType, final String message) throws DecodeException {
        if (targetType == Boolean.class || targetType == boolean.class) {
            return new Boolean(message);
        } else if (targetType == Character.class || targetType == char.class) {
            if (message.length() > 1) {
                throw new DecodeException(message, "Character message larger than 1 character");
            }
            return new Character(message.charAt(0));
        } else if (targetType == Byte.class || targetType == byte.class) {
            return new Byte(message);
        } else if (targetType == Short.class || targetType == short.class) {
View Full Code Here

                    }
                } else {
                    try {
                        return ((Decoder.BinaryStream) decoder).decode(new ByteArrayInputStream(bytes));
                    } catch (IOException e) {
                        throw new DecodeException(ByteBuffer.wrap(bytes), "Could not decode binary", e);
                    }
                }
            }
        }
        throw new DecodeException(ByteBuffer.wrap(bytes), "Could not decode binary");
    }
View Full Code Here

            for (Decoder.Text<T> decoder : decoders) {
                if (decoder.willDecode(value)) {
                    return decoder.decode(value);
                }
            }
            throw new DecodeException(value, JsrWebSocketMessages.MESSAGES.noDecoderAcceptedMessage(decoders));
        }
View Full Code Here

            for (Decoder.Binary<T> decoder : decoders) {
                if (decoder.willDecode(value)) {
                    return decoder.decode(value);
                }
            }
            throw new DecodeException(value, JsrWebSocketMessages.MESSAGES.noDecoderAcceptedMessage(decoders));
        }
View Full Code Here

TOP

Related Classes of javax.websocket.DecodeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.