Package org.apache.mina.codec

Examples of org.apache.mina.codec.ProtocolDecoderException


                    } else {
                        int overflowPosition = ctx.getOverflowLength();
                        throw new IllegalStateException("Line is too long: " + overflowPosition);
                    }
                } catch (CharacterCodingException cce) {
                    throw new ProtocolDecoderException(cce);
                } finally {
                    ctx.reset();
                }
                oldPos = pos;
                matchCount = 0;
View Full Code Here


                        } else {
                            int overflowLength = ctx.getOverflowLength();
                            throw new IllegalStateException("Line is too long: " + overflowLength);
                        }
                    } catch (CharacterCodingException cce) {
                        throw new ProtocolDecoderException(cce);
                    } finally {
                        ctx.reset();
                    }

                    oldPos = pos;
View Full Code Here

                           
                            // check that there are at most 3 significant bits available
                            if (((tmp = input.get()) & ~0x7) == 0) {
                                result |= tmp << 28;
                            } else {
                                throw new ProtocolDecoderException("Not the varint representation of a signed int32");
                            }
                        }
                    }
                }
                return result;
View Full Code Here

    @Override
    public IN decode(IoBuffer input) {
        try {
            return (IN) parseMethod.invoke(null, input.asInputStream(), registry);
        } catch (Exception e) {
            throw new ProtocolDecoderException(e);
        }
    }
View Full Code Here

            ObjectInputStream ois = new ObjectInputStream(input.asInputStream());
            IN s = (IN) ois.readObject();
            ois.close();
            return s;
        } catch (Exception ex) {
            throw new ProtocolDecoderException(ex);
        }
    }
View Full Code Here

                // LOG.debug("optionLength : {}", optionLength);

                // create the option DTO
                CoapOptionType optType = CoapOptionType.fromCode(optionCode);
                if (optType == null) {
                    throw new ProtocolDecoderException("unknown option code : " + optionCode);
                }
                // LOG.debug("option type : {}", optType);

                // get the value
                byte[] optionValue = new byte[optionLength];
                input.get(optionValue);

                options.add(new CoapOption(optType, optionValue));
                ;
            }
        }

        if (input.hasRemaining()) {
            throw new ProtocolDecoderException("trailling " + input.remaining() + " bytes in the UDP datagram");
        }
        return new CoapMessage(version, type, code, id, token, options.toArray(EMPTY_OPTION), payload);
    }
View Full Code Here

            // }
            return (input.get() & 0xFF) + 13;
        } else if (value == 14) {
            return (input.getShort() & 0xFFFF) + 269;
        } else {
            throw new ProtocolDecoderException("illegal option quartet value : " + value);
        }
    }
View Full Code Here

            input.get(array);
            object = clazz.newInstance();
            deserializer.deserialize(object, array);
            return object;
        } catch (TException e) {
            throw new ProtocolDecoderException(e);
        } catch (InstantiationException e) {
            throw new ProtocolDecoderException(e);
        } catch (IllegalAccessException e) {
            throw new ProtocolDecoderException(e);
        }
    }
View Full Code Here

                int optionLength = optionFromQuartet(optionLenQuartet, input);

                // create the option DTO
                CoapOptionType optType = CoapOptionType.fromCode(optionCode);
                if (optType == null) {
                    throw new ProtocolDecoderException("unknown option code : " + optionCode);
                }

                // get the value
                byte[] optionValue = new byte[optionLength];
                input.get(optionValue);

                options.add(new CoapOption(optType, optionValue));
            }
        }

        if (input.hasRemaining()) {
            throw new ProtocolDecoderException("trailling " + input.remaining() + " bytes in the UDP datagram");
        }
        return new CoapMessage(version, type, code, id, token, options.toArray(EMPTY_OPTION), payload);
    }
View Full Code Here

        } else if (value == 13) {
            return (input.get() & 0xFF) + 13;
        } else if (value == 14) {
            return (input.getShort() & 0xFFFF) + 269;
        } else {
            throw new ProtocolDecoderException("illegal option quartet value : " + value);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.codec.ProtocolDecoderException

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.