com.tangosol.util.ByteSequence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence Show documentation
Show all versions of coherence Show documentation
Oracle Coherence Community Edition
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.util;
/**
* Represents a sequence of bytes.
*
* @author cp 2010-06-06
* @since Coherence 3.7
*/
public interface ByteSequence
{
/**
* Determine the number of bytes of data represented by this
* ByteSequence.
*
* @return the number of bytes represented by this Node
*/
public int length();
/**
* Determine the n-th byte of the byte sequence.
*
* @param of the zero-based byte offset within the sequence of bytes
* (0 <= of < {@link #length()})
*
* @return the byte at the specified offset
*
* @throws IndexOutOfBoundsException if
* (of < 0 || of >= {@link #length ()})
*/
public byte byteAt(int of);
/**
* Returns a new ByteSequence
that is a subsequence of this
* sequence. The subsequence starts with the byte
value at the
* specified index and ends with the byte
value at index
* ofEnd - 1. The length (in byte
s) of the returned
* sequence is ofEnd - ofStart, so if ofStart == ofEnd
* then an empty sequence is returned.
*
* @param ofStart the start index, inclusive
* @param ofEnd the end index, exclusive
*
* @return the specified subsequence
*
* @throws IndexOutOfBoundsException
* if ofStart or ofEnd are negative,
* if ofEnd is greater than length(),
* or if ofStart is greater than ofEnd
*/
public ByteSequence subSequence(int ofStart, int ofEnd);
/**
* Returns a Binary object that holds the contents of this ByteSequence.
*
* @return the contents of this ByteSequence as a Binary object
*/
public Binary toBinary();
}