All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.mongoose.base.data.DataInputBase Maven / Gradle / Ivy

There is a newer version: 4.3.10
Show newest version
package com.emc.mongoose.base.data;

import java.io.IOException;
import java.nio.ByteBuffer;

/** Created by andrey on 24.07.17. */
public abstract class DataInputBase implements DataInput {

	protected ByteBuffer inputBuff;

	protected DataInputBase() {
		inputBuff = null;
	}

	protected DataInputBase(final ByteBuffer inputBuff) {
		this.inputBuff = inputBuff;
		inputBuff.clear();
	}

	protected DataInputBase(final DataInputBase other) {
		this.inputBuff = other.inputBuff;
	}

	@Override
	public final int getSize() {
		// NPE protection is necessary for the storage driver service
		return inputBuff == null ? 0 : inputBuff.capacity();
	}

	@Override
	public abstract ByteBuffer getLayer(final int layerIndex);

	@Override
	public void close() throws IOException {
		inputBuff = null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy