code: private void deserializeFromStream(final InputStream in) throws IOException
      {
          final byte[] dateTimeBytes = new byte[8];
          in.read(dateTimeBytes, 0, 8);
          eventDateTime = new DateTime(ByteBuffer.wrap(dateTimeBytes).getLong(0));
  
          final byte[] sizeGranularityInBytes = new byte[4];
          in.read(sizeGranularityInBytes, 0, 4);
          final byte[] granularityBytes = new byte[ByteBuffer.wrap(sizeGranularityInBytes).getInt(0)];
          in.read(granularityBytes, 0, granularityBytes.length);
          granularity = Granularity.valueOf(new String(granularityBytes, Charset.forName("UTF-8")));
  
          thriftEnvelope = deserializer.deserialize(null);
      }
docs: Given an InputStream, extract the eventDateTime, granularity and thriftEnvelope to build
  the ThriftEnvelopeEvent.
  This method expects the stream to be open and won't close it for you.
  
  @param in InputStream to read
  @throws IOException generic I/O Exception