public class ByteArrayRandomAccessData extends Object implements RandomAccessData
RandomAccessData
implementation backed by a byte array.RandomAccessData.ResourceAccess
Constructor and Description |
---|
ByteArrayRandomAccessData(byte[] bytes) |
ByteArrayRandomAccessData(byte[] bytes,
long offset,
long length) |
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStream(RandomAccessData.ResourceAccess access)
Returns an
InputStream that can be used to read the underlying data. |
long |
getSize()
Returns the size of the data.
|
RandomAccessData |
getSubsection(long offset,
long length)
Returns a new
RandomAccessData for a specific subsection of this data. |
public ByteArrayRandomAccessData(byte[] bytes)
public ByteArrayRandomAccessData(byte[] bytes, long offset, long length)
public InputStream getInputStream(RandomAccessData.ResourceAccess access)
RandomAccessData
InputStream
that can be used to read the underlying data. The
caller is responsible close the underlying stream.getInputStream
in interface RandomAccessData
access
- hint indicating how the underlying data should be accessedpublic RandomAccessData getSubsection(long offset, long length)
RandomAccessData
RandomAccessData
for a specific subsection of this data.getSubsection
in interface RandomAccessData
offset
- the offset of the subsectionlength
- the length of the subsectionpublic long getSize()
RandomAccessData
getSize
in interface RandomAccessData
Copyright © 2016 Pivotal Software, Inc.. All rights reserved.