code: public int read(ReadableByteChannel channel) throws IOException {
          // Header: segId (4), lastForcedTime (8), size (4)
          ByteBuffer header = ByteBuffer.allocate(HEADER_LENGTH);
          read(channel, header, HEADER_LENGTH, "Invalid Header");
          
          int segmentId = header.getInt(0);
          long lastForcedTime = header.getLong(4);
          int size = header.getInt(12);
          
          // Data
          int dataLength = size << 3;
          ByteBuffer data = ByteBuffer.allocate(dataLength);
          read(channel, data, dataLength, "Invalid Data");
          
          // Footer - MD5Digest (16)
          ByteBuffer md5 = ByteBuffer.allocate(MD5_LENGTH);
          read(channel, md5, MD5_LENGTH, "Invalid MD5");
          
          try {
              MessageDigest m = MessageDigest.getInstance("MD5");
              m.reset();
              m.update(header.array());
              m.update(data.array());
              byte[] digest = ensure128BitMD5(m.digest());
              
              if(Arrays.equals(md5.array(), digest)) {
                  setSegmentId(segmentId);
                  setSegmentLastForcedTime(lastForcedTime);
                  data.flip();
                  put(data);
              }
          } catch (NoSuchAlgorithmException e) {
              throw new IOException(e);
          }
          
          return (dataLength + HEADER_FOOTER_LENGTH);
      }
docs: Reads from the specified <code>channel</code> into this SegmentIndexBuffer.
  
  @param channel - the readable channel
  @return the number of bytes read from the specified channel.
  @throws IOException