/** {@inheritDoc} */ @Override public Object fromByteBuffer(ByteBuffer bytes) { if (bytes == null || !bytes.hasRemaining()) { return null; } int l = bytes.remaining(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes.array(), bytes.arrayOffset() + bytes.position(), l); try { XMLStreamReader reader = createStreamReader(bais); Object ret = unmarshaller.get().unmarshal(reader); reader.close(); return ret; } catch (JAXBException e) { throw new HectorSerializationException( "Jaxb exception occurred during deserialization.", e); } catch (XMLStreamException e) { throw new HectorSerializationException("Exception reading XML stream.", e); } }
/** {@inheritDoc} */ @Override public Object fromByteBuffer(ByteBuffer bytes) { if (bytes == null || !bytes.hasRemaining()) { return null; } int l = bytes.remaining(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes.array(), bytes.arrayOffset() + bytes.position(), l); try { XMLStreamReader reader = createStreamReader(bais); Object ret = unmarshaller.get().unmarshal(reader); reader.close(); return ret; } catch (JAXBException e) { throw new HectorSerializationException( "Jaxb exception occurred during deserialization.", e); } catch (XMLStreamException e) { throw new HectorSerializationException("Exception reading XML stream.", e); } }
/** {@inheritDoc} */ @Override public Object fromByteBuffer(ByteBuffer bytes) { if (bytes == null || !bytes.hasRemaining()) { return null; } ByteArrayInputStream bais = new ByteArrayInputStream(bytes.array()); try { XMLStreamReader reader = createStreamReader(bais); Object ret = unmarshaller.get().unmarshal(reader); reader.close(); return ret; } catch (JAXBException e) { throw new HectorSerializationException( "Jaxb exception occurred during deserialization.", e); } catch (XMLStreamException e) { throw new HectorSerializationException("Exception reading XML stream.", e); } }