format/src/main/java/com/github/sadikovi/riff/StripeInformation.java
/**
   * Read stripe information from provided byte buffer.
   * @param buf byte buffer
   * @throws IOException
   */
Read stripe information from provided byte buffer.
@param buf byte buffer
@throws IOException
Read stripe information from provided byte buffer . @param buf byte buffer @throws IOException
public static StripeInformation readExternal(ByteBuffer buf) throws IOException {
    int magic = buf.get();
    if (magic != MAGIC) {
      throw new IOException("Wrong magic: " + magic + " != " + MAGIC);
    }
    byte flags = buf.get();
    boolean hasStatistics = (flags & 1) != 0;
    boolean hasFilters = (flags & 2) != 0;
    short id = buf.getShort();
    long offset = buf.getLong();
    int length = buf.getInt();
    Statistics[] stats = null;
    if (hasStatistics) {
      int len = buf.getInt();
      stats = new Statistics[len];
      for (int i = 0; i < len; i++) {
        stats[i] = Statistics.readExternal(buf);
      }
    }
    ColumnFilter[] filters = null;
    if (hasFilters) {
      int len = buf.getInt();
      filters = new ColumnFilter[len];
      for (int i = 0; i < len; i++) {
        filters[i] = ColumnFilter.readExternal(buf);
      }
    }
    return new StripeInformation(id, offset, length, stats, filters);
  }
public static StripeInformation readExternal ( ByteBuffer buf ) throws IOException { int magic = buf . get ( ) ; if ( magic != MAGIC ) { throw new IOException ( "Wrong magic: " + magic + " != " + MAGIC ) ; } byte flags = buf . get ( ) ; boolean hasStatistics = ( flags & 1 ) != 0 ; boolean hasFilters = ( flags & 2 ) != 0 ; short id = buf . getShort ( ) ; long offset = buf . getLong ( ) ; int length = buf . getInt ( ) ; Statistics [ ] stats = null ; if ( hasStatistics ) { int len = buf . getInt ( ) ; stats = new Statistics [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { stats [ i ] = Statistics . readExternal ( buf ) ; } } ColumnFilter [ ] filters = null ; if ( hasFilters ) { int len = buf . getInt ( ) ; filters = new ColumnFilter [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { filters [ i ] = ColumnFilter . readExternal ( buf ) ; } } return new StripeInformation ( id , offset , length , stats , filters ) ; }
Read stripe information from provided byte buffer.
Read stripe information from provided byte buffer .
// check magic // stripe flags