com.abubusoft.kripton.common.KriptonByteArrayOutputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kripton-core Show documentation
Show all versions of kripton-core Show documentation
Kripton Persistence Library - core module
package com.abubusoft.kripton.common;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import com.abubusoft.kripton.exception.KriptonRuntimeException;
/**
* Acts as a ByteArrayOutputStream, but allow direct access to array of byte
* inside, without copy it.
*
* @author Francesco Benincasa ([email protected])
*
*/
public class KriptonByteArrayOutputStream extends ByteArrayOutputStream {
public KriptonByteArrayOutputStream() {
}
public KriptonByteArrayOutputStream(int size) {
super(size);
}
public int getCount() {
return count;
}
public byte[] getByteBuffer() {
return buf;
}
public byte[] getByteBufferCopy() {
return Arrays.copyOf(buf, count);
}
@Override
public void close() {
try {
super.close();
} catch (IOException e) {
e.printStackTrace();
throw (new KriptonRuntimeException(e));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy