com.gemstone.org.jgroups.util.ExposedByteArrayInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-jgroups Show documentation
Show all versions of gemfire-jgroups Show documentation
SnappyData store based off Pivotal GemFireXD
The newest version!
/** Notice of modification as required by the LGPL
* This file was modified by Gemstone Systems Inc. on
* $Date$
**/
package com.gemstone.org.jgroups.util;
import java.io.ByteArrayInputStream;
/**
* @author Bela Ban
* @version $Id: ExposedByteArrayInputStream.java,v 1.1 2005/07/25 15:53:36 belaban Exp $
*/
public class ExposedByteArrayInputStream extends ByteArrayInputStream {
/**
* Creates a ByteArrayInputStream
* so that it uses buf
as its
* buffer array.
* The buffer array is not copied.
* The initial value of pos
* is 0
and the initial value
* of count
is the length of
* buf
.
*
* @param buf the input buffer.
*/
public ExposedByteArrayInputStream(byte[] buf) {
super(buf);
}
/**
* Creates ByteArrayInputStream
* that uses buf
as its
* buffer array. The initial value of pos
* is offset
and the initial value
* of count
is the minimum of offset+length
* and buf.length
.
* The buffer array is not copied. The buffer's mark is
* set to the specified offset.
*
* @param buf the input buffer.
* @param offset the offset in the buffer of the first byte to read.
* @param length the maximum number of bytes to read from the buffer.
*/
public ExposedByteArrayInputStream(byte[] buf, int offset, int length) {
super(buf, offset, length);
}
public void setData(byte[] buf, int offset, int length) {
this.buf = buf;
this.pos = offset;
this.count = Math.min(offset + length, buf.length);
this.mark = offset;
}
}