- java.lang.Object
-
- de.carne.mcd.MachineCodeDecoder
-
public abstract class MachineCodeDecoder extends java.lang.ObjectBase class for all kinds of machine code decoders.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMachineCodeDecoder(java.lang.String name, java.nio.ByteOrder byteOrder, long defaultLimit)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.nio.ByteOrderbyteOrder()Gets this MachineCodeDecoder instance's byte order.longdecode(java.nio.channels.ReadableByteChannel in, MCDOutput out)Decodes the given byte channel's data.longdecode(java.nio.channels.ReadableByteChannel in, MCDOutput out, long offset)Decodes the given byte channel's data.longdecode(java.nio.channels.ReadableByteChannel in, MCDOutput out, long offset, long limit)Decodes the given byte channel's data.protected abstract longdecode0(MCDInputBuffer in, MCDOutputBuffer out, long offset, long limit)longdefaultLimit()Gets this MachineCodeDecoder instance's default decode limit.static MachineCodeDecodergetDecoder()Gets the active MachineCodeDecoder.static <T extends MachineCodeDecoder>
TgetDecoder(java.lang.Class<T> decoderType)Gets the active MachineCodeDecoder.java.lang.Stringname()Gets this MachineCodeDecoder instance's name.voidsetByteOrder(java.nio.ByteOrder byteOrder)Sets this MachineCodeDecoder instance's byte order.voidsetDefaultLimit(long defaultLimit)Sets this MachineCodeDecoder instance's default decode limit.
-
-
-
Method Detail
-
getDecoder
public static MachineCodeDecoder getDecoder()
Gets the active MachineCodeDecoder.- Returns:
- the MachineCodeDecoder instance associated with the current decode call.
- Throws:
java.lang.IllegalStateException- if called outside a decode call.
-
getDecoder
public static <T extends MachineCodeDecoder> T getDecoder(java.lang.Class<T> decoderType)
Gets the active MachineCodeDecoder.- Type Parameters:
T- the actual decoder type.- Parameters:
decoderType- the decoder type to get.- Returns:
- the MachineCodeDecoder instance associated with the current decode call.
- Throws:
java.lang.IllegalStateException- if called outside a decode call.
-
name
public java.lang.String name()
Gets this MachineCodeDecoder instance's name.- Returns:
- this MachineCodeDecoder instance's name.
-
byteOrder
public java.nio.ByteOrder byteOrder()
Gets this MachineCodeDecoder instance's byte order.- Returns:
- this MachineCodeDecoder instance's byte order.
-
setByteOrder
public void setByteOrder(java.nio.ByteOrder byteOrder)
Sets this MachineCodeDecoder instance's byte order.- Parameters:
byteOrder- the ByteOrder to set.
-
defaultLimit
public long defaultLimit()
Gets this MachineCodeDecoder instance's default decode limit.- Returns:
- this MachineCodeDecoder instance's default decode limit.
-
setDefaultLimit
public void setDefaultLimit(long defaultLimit)
Sets this MachineCodeDecoder instance's default decode limit.- Parameters:
defaultLimit- the default decode limit to use.
-
decode
public long decode(java.nio.channels.ReadableByteChannel in, MCDOutput out) throws java.io.IOExceptionDecodes the given byte channel's data.- Parameters:
in- the ReadableByteChannel to decode from.out- the MCDOutput to decode to.- Returns:
- the number of decoded bytes.
- Throws:
java.io.IOException- if an I/O error occurs.
-
decode
public long decode(java.nio.channels.ReadableByteChannel in, MCDOutput out, long offset) throws java.io.IOExceptionDecodes the given byte channel's data.- Parameters:
in- the ReadableByteChannel to decode from.out- the MCDOutput to decode to.offset- the current decode offset.- Returns:
- the number of decoded bytes.
- Throws:
java.io.IOException- if an I/O error occurs.
-
decode
public long decode(java.nio.channels.ReadableByteChannel in, MCDOutput out, long offset, long limit) throws java.io.IOExceptionDecodes the given byte channel's data.- Parameters:
in- the ReadableByteChannel to decode from.out- the MCDOutput to decode to.offset- the current decode offset.limit- the number of bytes after which decoding should stop.- Returns:
- the number of decoded bytes.
- Throws:
java.io.IOException- if an I/O error occurs.
-
decode0
protected abstract long decode0(MCDInputBuffer in, MCDOutputBuffer out, long offset, long limit) throws java.io.IOException
- Throws:
java.io.IOException
-
-