Package ghidra.app.util.bin
Interface ByteProvider
- 
- All Superinterfaces:
- java.lang.AutoCloseable,- java.io.Closeable
 - All Known Subinterfaces:
- MutableByteProvider
 - All Known Implementing Classes:
- ByteArrayProvider,- ByteProviderWrapper,- InputStreamByteProvider,- MemoryByteProvider,- MemoryMutableByteProvider,- RandomAccessByteProvider,- RandomAccessMutableByteProvider,- SynchronizedByteProvider
 
 public interface ByteProvider extends java.io.CloseableAn interface for a generic random-access byte provider.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Releases any resources the provider may have occupied.java.lang.StringgetAbsolutePath()Returns the absolute path (similar to, but not a, URI) to the byte provider.java.io.FilegetFile()Returns the underlying file for this byte provider.default FSRLgetFSRL()Returns theFSRLof the underlying file for this byte provider, or null if this byte provider is not associated with a file.java.io.InputStreamgetInputStream(long index)Returns an input stream to the underlying byte provider starting at the specified indexjava.lang.StringgetName()Returns the name of the byte provider.booleanisValidIndex(long index)Returns true if the specified index is valid.longlength()Returns the length of the underlying provider.bytereadByte(long index)Reads a byte at the specified index.byte[]readBytes(long index, long length)Reads a byte array at the specified index.
 
- 
- 
- 
Method Detail- 
getFSRLdefault FSRL getFSRL() Returns theFSRLof the underlying file for this byte provider, or null if this byte provider is not associated with a file.- Returns:
- FSRLof the underlying file, or null if no associated file.
 
 - 
getFilejava.io.File getFile() Returns the underlying file for this byte provider. Or null if this byte provider is not associated with a file.- Returns:
- the underlying file for this byte provider
 
 - 
getNamejava.lang.String getName() Returns the name of the byte provider. For example, the underlying file name.- Returns:
- the name of the byte provider or null
 
 - 
getAbsolutePathjava.lang.String getAbsolutePath() Returns the absolute path (similar to, but not a, URI) to the byte provider. For example, the complete path to the file.- Returns:
- the absolute path to the byte provider or null
 
 - 
lengthlong length() throws java.io.IOExceptionReturns the length of the underlying provider.- Returns:
- the length of the underlying provider
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
isValidIndexboolean isValidIndex(long index) Returns true if the specified index is valid.- Parameters:
- index- the index in the byte provider
- Returns:
- returns true if the specified index is valid
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
closevoid close() throws java.io.IOExceptionReleases any resources the provider may have occupied.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readBytebyte readByte(long index) throws java.io.IOExceptionReads a byte at the specified index.- Parameters:
- index- the index to read the byte
- Returns:
- the byte read from the specified index
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readBytesbyte[] readBytes(long index, long length) throws java.io.IOExceptionReads a byte array at the specified index.- Parameters:
- index- the index to read the byte array
- length- the number of elements to read
- Returns:
- the byte array read from the specified index
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
getInputStreamjava.io.InputStream getInputStream(long index) throws java.io.IOExceptionReturns an input stream to the underlying byte provider starting at the specified indexThe caller is responsible for closing the returned InputStreaminstance.- Parameters:
- index- the index to initialize the input stream
- Returns:
- the input stream
- Throws:
- java.io.IOException- if an I/O error occurs
 
 
- 
 
-