protected void init( int defaultIndexSizePower ) {
		int headerSize = 32; // "SLF2" + "INDX" + chunkRef + "RECY" + chunkRef + "EHDR"
		if( blob.getSize() == 0 ) {
			indexOffset = headerSize;
			indexMask = indexMask(defaultIndexSizePower);
			indexSize = indexSize(defaultIndexSizePower);
			reclRefOffset = 20; 
					
			int headerAndIndexSize = headerSize + ((1 << defaultIndexSizePower) << 3);
			byte[] headerAndIndex = new byte[headerAndIndexSize];
			copy( slf2, headerAndIndex, 0 );
			copy( indx, headerAndIndex, 4 );
			encodeLong( chunkRef(headerSize,defaultIndexSizePower), headerAndIndex, 8 );
			copy( recl, headerAndIndex, 16 );
			encodeLong( 0, headerAndIndex, 20 );
			copy( ehdr, headerAndIndex, 28 );
			blob.put(0, new SimpleByteChunk(headerAndIndex));
		} else {
			ByteChunk headerBlob = blob.get( 0, headerSize );
			if( headerBlob.getSize() < headerSize ) {
				throw new RuntimeException("Couldn't read entire "+headerSize+"-byte SLF2 header (read "+headerBlob.getSize()+" bytes) from "+getFilename());
			}
			byte[] buf = headerBlob.getBuffer();
			int o = headerBlob.getOffset();
			if( !equals(slf2, buf, o+0 ) ) {
				throw new RuntimeException("Found invalid SLF2 magic");
			}
			o = 4;
			while( o < headerSize && !equals(ehdr, buf, o)  ) {
				if( equals(indx, buf, o) ) {
					long indxRef = decodeLong( buf, o+4 );
					indexOffset = refOffset(indxRef);
					int indexSizePower = refSize(indxRef);
					indexMask = indexMask(indexSizePower);
					indexSize = indexSize(indexSizePower);
					o += 12;
				} else if( equals(recl, buf, o) ) {
					reclRefOffset = o+4;
					o += 12;
				} else {
					o += 4;
				}
				
			}
		}
	}