List of usage examples for io.netty.handler.codec.serialization ObjectDecoderInputStream ObjectDecoderInputStream
public ObjectDecoderInputStream(InputStream in)
From source file:de.sanandrew.core.manpack.util.javatuples.Tuple.java
License:Apache License
public static Tuple readFromByteBufStream(ByteBufInputStream stream) { try (ObjectDecoderInputStream odis = new ObjectDecoderInputStream(stream)) { return (Tuple) odis.readObject(); } catch (IOException | ClassNotFoundException ex) { ManPackLoadingPlugin.MOD_LOG.log(Level.ERROR, "Cannot deserialize Tuple!", ex); }/*from w ww.ja v a2 s . c o m*/ return null; }
From source file:de.sanandrew.mods.sanlib.lib.Tuple.java
License:Creative Commons License
/** * Deserializes a Tuple read from an InputStream via an {@link ObjectDecoderInputStream}. * @param stream The InputStream a Tuple is in. * @return a Tuple, if one is present and can be read, {@code null} otherwise *//* ww w. j a v a 2 s . c o m*/ public static Tuple readFromStream(InputStream stream) { try (ObjectDecoderInputStream odis = new ObjectDecoderInputStream(stream)) { return (Tuple) odis.readObject(); } catch (IOException | ClassNotFoundException ex) { SanLib.LOG.log(Level.ERROR, "Cannot deserialize Tuple!", ex); } return null; }