Class ByteArrayRandomAccessData
- java.lang.Object
- org.springframework.boot.loader.data.ByteArrayRandomAccessData
- All Implemented Interfaces:
RandomAccessData
public class ByteArrayRandomAccessData extends Object implements RandomAccessData
RandomAccessDataimplementation backed by a byte array.
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.boot.loader.data.RandomAccessData
RandomAccessData.ResourceAccess
Constructor Summary
Constructors Constructor Description ByteArrayRandomAccessData(byte[] bytes)ByteArrayRandomAccessData(byte[] bytes, long offset, long length)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetInputStream(RandomAccessData.ResourceAccess access)Returns anInputStreamthat can be used to read the underlying data.longgetSize()Returns the size of the data.RandomAccessDatagetSubsection(long offset, long length)Returns a newRandomAccessDatafor a specific subsection of this data.
Constructor Detail
ByteArrayRandomAccessData
public ByteArrayRandomAccessData(byte[] bytes)
ByteArrayRandomAccessData
public ByteArrayRandomAccessData(byte[] bytes, long offset, long length)
Method Detail
getInputStream
public InputStream getInputStream(RandomAccessData.ResourceAccess access)
Description copied from interface:RandomAccessDataReturns anInputStreamthat can be used to read the underlying data. The caller is responsible close the underlying stream.- Specified by:
getInputStreamin interfaceRandomAccessData- Parameters:
access- hint indicating how the underlying data should be accessed- Returns:
- a new input stream that can be used to read the underlying data.
getSubsection
public RandomAccessData getSubsection(long offset, long length)
Description copied from interface:RandomAccessDataReturns a newRandomAccessDatafor a specific subsection of this data.- Specified by:
getSubsectionin interfaceRandomAccessData- Parameters:
offset- the offset of the subsectionlength- the length of the subsection- Returns:
- the subsection data
getSize
public long getSize()
Description copied from interface:RandomAccessDataReturns the size of the data.- Specified by:
getSizein interfaceRandomAccessData- Returns:
- the size