public void read(long devOffset, ByteBuffer dest) throws IOException {   if (dest.remaining() == 0) { return; }  final int ofsMisAlign = (int)(devOffset % alignment); final int lenMisAlign = (dest.remaining() % alignment);     if ((ofsMisAlign != 0) || (lenMisAlign != 0)) {  final ByteBuffer buf = ByteBuffer.allocate((dest.remaining() / alignment)  + alignment);  parentApi.read(devOffset - ofsMisAlign, buf); if (ofsMisAlign != 0) { ByteBufferUtils.buffercopy(buf, alignment - ofsMisAlign, dest, dest.position(), dest.remaining()); } else { ByteBufferUtils.buffercopy(buf, 0, dest, dest.position(), dest.remaining()); } } else {   parentApi.read(devOffset, dest); } }
public void read(long offset, ByteBuffer dst) throws IOException { final int length = dst.remaining();     if (length == 0) return;  final int ofsR = (int) (offset % alignment); final int lenR = (int) (length % alignment);    if ((ofsR != 0) || (lenR != 0)) { final int buflen = alignment + (length - lenR);      ByteBuffer buf = ByteBuffer.allocate(buflen);  parentApi.read(offset - ofsR, buf);  ByteBufferUtils.buffercopy (buf, ofsR, dst, dst.position(), length); } else {  parentApi.read(offset, dst); } }
	public void read(long devOffset, ByteBuffer dest)	throws IOException {      //log.info("Original: devOffset="+ devOffset + " destOffset=" + destOffset + " length=" + length);      //log.info("Original: alignment=" + alignment);		if (dest.remaining() == 0) {			return;		}				final int ofsMisAlign = (int)(devOffset % alignment);		final int lenMisAlign = (dest.remaining() % alignment);		      //log.info("ofsMisAlign="+ ofsMisAlign + " lenMisAlign=" + lenMisAlign);                		if ((ofsMisAlign != 0) || (lenMisAlign != 0)) {			// final byte[] buf = new byte[length + ofsMisAlign + (alignment - lenMisAlign)];         final ByteBuffer buf = ByteBuffer.allocate((dest.remaining() / alignment)  + alignment);        // log.info("temp buf =" + buf.length);			parentApi.read(devOffset - ofsMisAlign, buf);			if (ofsMisAlign != 0) {                ByteBufferUtils.buffercopy(buf, alignment - ofsMisAlign, dest, dest.position(), dest.remaining());			} else {                ByteBufferUtils.buffercopy(buf, 0, dest, dest.position(), dest.remaining());			}		} else {			// Aligned call, pass on         //log.info("aligned call");			parentApi.read(devOffset, dest);		}	}