public void write(long devOffset, ByteBuffer src) throws IOException {  if (src.remaining() == 0) { return; }  final int ofsMisAlign = (int)(devOffset % alignment); final int lenMisAlign = (src.remaining() % alignment);  if ((ofsMisAlign != 0) || (lenMisAlign != 0)) { log.warn("Very expensive misaligned write called!"); final ByteBuffer buf = ByteBuffer.allocate(src.remaining() + ofsMisAlign + (alignment - lenMisAlign));  parentApi.read(devOffset - ofsMisAlign, buf); if (ofsMisAlign != 0) { ByteBufferUtils.buffercopy(src, src.position(), buf, alignment - ofsMisAlign, src.remaining()); } else { ByteBufferUtils.buffercopy(src, src.position(), buf, 0, src.remaining()); }
public void write(long offset, ByteBuffer src) throws IOException { int length = src.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);    log.warn("Very expensive misaligned write called!");  parentApi.read(offset - ofsR, buf);  ByteBufferUtils.buffercopy (src, src.position(), buf, ofsR, length);
	public void write(long devOffset, ByteBuffer src)	throws IOException {				if (src.remaining() == 0) {			return;		}				final int ofsMisAlign = (int)(devOffset % alignment);		final int lenMisAlign = (src.remaining() % alignment);				if ((ofsMisAlign != 0) || (lenMisAlign != 0)) {			log.warn("Very expensive misaligned write called!");			final ByteBuffer buf = ByteBuffer.allocate(src.remaining() + ofsMisAlign + (alignment - lenMisAlign));			// TODO: This is very expensive, make it cheaper!			parentApi.read(devOffset - ofsMisAlign, buf);			if (ofsMisAlign != 0) {				ByteBufferUtils.buffercopy(src, src.position(), buf, alignment - ofsMisAlign, src.remaining());			} else {                ByteBufferUtils.buffercopy(src, src.position(), buf, 0, src.remaining());			}            buf.clear();			parentApi.write(devOffset - ofsMisAlign, buf);		} else {			// Aligned call, pass on			parentApi.write(devOffset, src);		}	}