Module de.carne.mcd
Package de.carne.mcd

Class MachineCodeDecoder


  • public abstract class MachineCodeDecoder
    extends java.lang.Object
    Base class for all kinds of machine code decoders.
    • Constructor Detail

      • MachineCodeDecoder

        protected MachineCodeDecoder​(java.lang.String name,
                                     java.nio.ByteOrder byteOrder,
                                     long defaultLimit)
    • Method Detail

      • 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.
      • setByteOrder

        public void setByteOrder​(java.nio.ByteOrder byteOrder)
        Sets this MachineCodeDecoder instance's byte order.
        Parameters:
        byteOrder - the ByteOrder to set.
      • 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.IOException
        Decodes 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.IOException
        Decodes 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.IOException
        Decodes 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