Package com.pnfsoftware.jeb.core.input
Class LazyInput
java.lang.Object
com.pnfsoftware.jeb.core.input.LazyInput
- All Implemented Interfaces:
IInput
An input backed by an
IDataProvider
.-
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.input.IInput
IDEAL_HEADER_SIZE
-
Constructor Summary
ConstructorsConstructorDescriptionLazyInput
(IDataProvider prv, String entryName, long hintEntrySize) LazyInput
(IDataProvider prv, String entryName, long hintEntrySize, int id) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRead()
Determine whether this input is readable.void
close()
Close that input and free all resources used by this object.Get a seekable read-only channel representing the input.long
Provide the current input size of the input data.Get a read-only, big-endian buffer of the first input bytes.getName()
Retrieve the optional input name.Get the input stream.
-
Constructor Details
-
LazyInput
-
LazyInput
- Parameters:
prv
-entryName
-hintEntrySize
-id
-
-
-
Method Details
-
getName
Description copied from interface:IInput
Retrieve the optional input name. -
canRead
public boolean canRead()Description copied from interface:IInput
Determine whether this input is readable. -
close
public void close()Description copied from interface:IInput
Close that input and free all resources used by this object. -
getCurrentSize
public long getCurrentSize()Description copied from interface:IInput
Provide the current input size of the input data.- Specified by:
getCurrentSize
in interfaceIInput
- Returns:
- the size, -1 if the size cannot be calculated or if an error occurred
-
getHeader
Description copied from interface:IInput
Get a read-only, big-endian buffer of the first input bytes. Clients should not attempt to modify or directly access that buffer. The initial position is set to 0. It is recommended that implementations provide at leastIInput.IDEAL_HEADER_SIZE
bytes.- Specified by:
getHeader
in interfaceIInput
- Returns:
- a unique buffer; on error, the returned buffer is null (unlike other methods declared
in this interface, this method does not throw
IOException
)
-
getChannel
Description copied from interface:IInput
Get a seekable read-only channel representing the input. Each call returns a unique channel. Clients should use this method to efficiently read at various locations within the given input.- Specified by:
getChannel
in interfaceIInput
- Returns:
- a unique seekable channel
- Throws:
IOException
- on IO error
-
getStream
Description copied from interface:IInput
Get the input stream. Each call returns a unique stream. Implementors should offer this method for convenience. The implementor is responsible for closing non-closed streams whenIInput.close()
is called.- Specified by:
getStream
in interfaceIInput
- Returns:
- a unique input stream
- Throws:
IOException
- on IO error
-