@ Override public byte [ ] get ( int index ) { rangeCheck ( index ) ; try { long address = getAddress ( index ) ; int segPos = _addressFormat . getOffset ( address ) ; int segInd = _addressFormat . getSegment ( address ) ; // no data found if ( segPos < Segment . dataStartPosition ) return null ; // get data segment Segment seg = _segmentManager . getSegment ( segInd ) ; if ( seg == null ) return null ; // read data length int size = _addressFormat . getDataSize ( address ) ; int len = ( size == 0 ) ? seg . readInt ( segPos ) : size ; // read data into byte array byte [ ] data = new byte [ len ] ; if ( len > 0 ) { seg . read ( segPos + 4 , data ) ; } return data ; } catch ( Exception e ) { _log . warn ( e . getMessage ( ) ) ; return null ; } }
Gets data at a given index .