Package javax.websocket

Examples of javax.websocket.DecodeException


                message.get(array);
                ByteArrayInputStream bais = new ByteArrayInputStream(array);
                try {
                    return ((BinaryStream<?>) decoder).decode(bais);
                } catch (IOException ioe) {
                    throw new DecodeException(message, sm.getString(
                            "pojoMessageHandlerWhole.decodeIoFail"), ioe);
                }
            }
        }
        return null;
View Full Code Here


//    else if ( /* message is a B message */)
//      return new MessageB(...);
    if (willDecode(msg)) {
      return JSON.parseObject(msg, Message.class);
    } else {
      throw new DecodeException(msg, "[Message] Can't decode.");
    }
  }
View Full Code Here

                    }
                } else {
                    try {
                        return ((Decoder.TextStream) decoder).decode(new StringReader(message));
                    } catch (IOException e) {
                        throw new DecodeException(message, "Could not decode string", e);
                    }
                }
            }
        }
        throw new DecodeException(message, "Could not decode string");
    }
View Full Code Here

    private Object decodePrimitive(final Class<?> targetType, final String message) throws DecodeException {
        if (targetType == Boolean.class || targetType == boolean.class) {
            return Boolean.valueOf(message);
        } else if (targetType == Character.class || targetType == char.class) {
            if (message.length() > 1) {
                throw new DecodeException(message, "Character message larger than 1 character");
            }
            return Character.valueOf(message.charAt(0));
        } else if (targetType == Byte.class || targetType == byte.class) {
            return Byte.valueOf(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

        }

        @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

                    }
                } else {
                    try {
                        return ((Decoder.TextStream) decoder).decode(new StringReader(message));
                    } catch (IOException e) {
                        throw new DecodeException(message, "Could not decode string", e);
                    }
                }
            }
        }
        throw new DecodeException(message, "Could not decode string");
    }
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

    {
        Pattern pat = Pattern.compile("([^|]*)|([^|]*)");
        Matcher mat = pat.matcher(s);
        if (!mat.find())
        {
            throw new DecodeException(s,"Unable to find Fruit reference encoded in text message");
        }

        Fruit fruit = new Fruit();
        fruit.name = mat.group(1);
        fruit.color = mat.group(2);
View Full Code Here

        {
            return new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z").parse(s);
        }
        catch (ParseException e)
        {
            throw new DecodeException(s,e.getMessage(),e);
        }
    }
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.