public class

SubInput

extends Object
implements IInput
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.input.SubInput

Class Overview

An input object presenting a partial view of another input.

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.input.IInput
Public Constructors
SubInput(IInput input, long offset, long size)
Public constructor.
Public Methods
boolean canRead()
Determine whether this input is readable.
void close()
Close that input and free all resources used by this object.
SeekableByteChannel getChannel()
Get a seekable read-only channel representing the input.
long getCurrentSize()
Provide the current input size of the input data.
ByteBuffer getHeader()
Get a read-only, big-endian buffer of the first input bytes.
InputStream getStream()
Get the input stream.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.input.IInput

Public Constructors

public SubInput (IInput input, long offset, long size)

Public constructor.

Throws
IOException

Public Methods

public boolean canRead ()

Determine whether this input is readable.

public void close ()

Close that input and free all resources used by this object.

public SeekableByteChannel getChannel ()

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.

Returns
  • a unique seekable channel
Throws
IOException

public long getCurrentSize ()

Provide the current input size of the input data.

Returns
  • the size, -1 if the size cannot be calculated or if an error occurred

public ByteBuffer getHeader ()

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 least IDEAL_HEADER_SIZE bytes.

Returns
  • a unique buffer; on error, the returned buffer is null (unlike other methods declared in this interface, this method does not throw IOException)

public InputStream getStream ()

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 when close() is called.

Returns
  • a unique input stream
Throws
IOException