private int optionFromQuartet(int value, ByteBuffer input) { if (value < 13) { return value; } 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); } } }
@SuppressWarnings("unchecked") @Override public IN decode(IoBuffer input) { try { return (IN) parseMethod.invoke(null, input.asInputStream(), registry); } catch (Exception e) { throw new ProtocolDecoderException(e); } } }
@SuppressWarnings("unchecked") @Override public IN decode(final IoBuffer input) { try { ObjectInputStream ois = new ObjectInputStream(input.asInputStream()); IN s = (IN) ois.readObject(); ois.close(); return s; } catch (Exception ex) { throw new ProtocolDecoderException(ex); } } }
/** * {@inheritDoc} */ @Override public OUTPUT decode(IoBuffer input) { OUTPUT object; try { byte array[] = new byte[input.remaining()]; 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); } }
@Override public T decode(IoBuffer input) { BinaryDecoder binaryDecoder = DecoderFactory.get().binaryDecoder(input.array(), null); ReflectDatumReader<T> reader = new ReflectDatumReader<T>(schema); T result = null; try { result = reader.read(null, binaryDecoder); }catch (IOException ioEx) { LOG.error("Error while decoding", ioEx); throw new ProtocolDecoderException(ioEx.getMessage()); } return result; } }
throw new ProtocolDecoderException("unknown option code : " + optionCode); throw new ProtocolDecoderException("trailling " + input.remaining() + " bytes in the UDP datagram");
throw new ProtocolDecoderException(cce); } finally { ctx.reset();
throw new ProtocolDecoderException(cce); } finally { ctx.reset();
result |= tmp << 28; } else { throw new ProtocolDecoderException("Not the varint representation of a signed int32");
private int optionFromQuartet(int value, ByteBuffer input) { if (value < 13) { return value; } 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); } } }
throw new ProtocolDecoderException("unknown option code : " + optionCode); throw new ProtocolDecoderException("trailling " + input.remaining() + " bytes in the UDP datagram");