public final static Block[] getBlocksFromByteArray( byte[] bbuf, int type )
	{
		int SIZE = 0;
		switch( type )
		{
			case Block.BIG:
				SIZE = 512;
				break;
			case Block.SMALL:
				SIZE = 64;
		}
		if( bbuf == null )
		{
			return null;
		}
//		int sz = LEOFile.getSizeInBlocks(bbuf.length,SIZE);		

		int len = (bbuf.length) / SIZE;
		int pos = 0;
		int sizeDiff = 0;
		int size = 0;

		if( (len * SIZE) < bbuf.length )
		{
			len++;    // PAD - this most usually hits when called from buildSSAT
			sizeDiff = (len * SIZE) - bbuf.length;
			byte[] bb = new byte[sizeDiff];
			bbuf = ByteTools.append( bb, bbuf );
		}
		Block[] blockarr = new Block[len];

		int start = 1;    // for BigBlocks, skip 1st block, for small
		if( type == Block.SMALL )
		{
			start = 0;
		}
		// get ALL blockVect (512 byte chunks of file)
		for( int i = 0; i < len; i++ )
		{
			Block bbd = getPrototypeBlock( type );
			byte[] bb = bbd.getBytes();
			
/*			int filepos = (i + start) * SIZE;
			if (type==Block.SMALL)	// smallblocks don't need file offset as they are allocated differently than bigblocks
				filepos= 0;
*/
			size = SIZE;
			// make it simpler:
			if( (bbuf.length - pos) < size )
			{
				size = (bbuf.length - pos);    // account for leftovers (Block padding)
			}
			/*if (i + start == len) {
				size -= sizeDiff; // account for leftovers (Block padding)
			}*/
			// ExcelTools.benchmark("BlockFactory initting new Block@: " + pos + " sz: " +size + " len:" + bbuf.length);
			System.arraycopy( bbuf, pos, bb, 0, size );
			bbd.init( ByteBuffer.wrap( bb ), i, 0 );    // THIS IS A BYTEARRAY ALL OFFSETS ARE 0 filepos);
			pos += size;
			blockarr[i] = bbd;
		}
		return blockarr;
	}