lev

## Class LImport

- java.lang.Object
- - lev.LImport

- Direct Known Subclasses:
    LByteChannel, LInChannel, LShrinkArray

      public abstract class LImport
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LImport()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `available()`
    `abstract void` | `close()`
    `LShrinkArray` | `correctForCompression()` Assumes the contents of the ShrinkArray is raw zipped data in its entirety, and nothing else.
    `abstract byte[]` | `extract(int amount)` Reads in amount of bytes and converts them to integers. Moves position forward.
    `byte[]` | `extract(int skip, int read)` Skips an amount of bytes, reads in amount of bytes and converts them to integers. Moves position forward.
    `byte[]` | `extractAllBytes()` Returns the remaining contents as a byte array, and adjusts bounds to be empty.
    `java.lang.String` | `extractAllString()` Extracts the remaining data and returns it as a string.
    `boolean` | `extractBool(int amount)`
    `float` | `extractFloat()` Extracts 4 bytes and returns their float representation Bumps the lower bound up so that following extracts do not extract the same data.
    `int` | `extractInt(int read)`
    `int` | `extractInt(int skip, int read)` Reads in the desired bytes and converts them to a int (little endian assumed).
    `int[]` | `extractInts(int amount)` Extracts specified number of ints.
    `int[]` | `extractInts(int skip, int read)` Reads in the desired bytes and converts them to an int array.
    `int` | `extractIntSigned(int read)` Reads in the desired bytes and converts them to a int (little endian assumed).
    `java.lang.String` | `extractLine()` Reads in a line until a newline character is found.
    `long` | `extractLong(int skip, int read)` Reads in the desired bytes and converts them to a long (little endian assumed).
    `java.lang.String` | `extractString()` Reads in characters until a null byte (0) is read, and converts them to a string.
    `java.lang.String` | `extractString(int amount)` Extracts the specified number of bytes, and returns the string representation. Bumps the lower bound up so that following extracts do not extract the same data.
    `java.lang.String` | `extractString(int skip, int read)` Reads in the desired bytes and converts them to a string.
    `byte[]` | `extractUntil(byte[]... delimiters)` Reads in bytes until any of the delimiters are read.
    `byte[]` | `extractUntil(char delimiter)` Reads in bytes until the delimiter is read.
    `byte[]` | `extractUntil(char delimiter, int bufsize)` Reads in bytes until the delimiter is read.
    `byte[]` | `extractUntil(int delimiter)` Reads in bytes until the delimiter is read.
    `byte[]` | `extractUntil(int delimiter, int bufsize)` Reads in bytes until the delimiter is read.
    `byte[]` | `getAllBytes()` Returns the remaining contents as a byte array, but does NOT adjust the bounds.
    `byte[]` | `getBytes(int skip, int amount)` Gets specified number of bytes after skipping the desired amount.
    `int[]` | `getInts(int skip, int read)` Skips an amount of bytes, reads in amount of bytes and converts them to integers. Does NOT move position.
    `java.lang.String` | `getString(int amount)` Gets specified number of bytes and converts them to a string.
    `java.lang.String` | `getString(int skip, int amount)` Gets specified number of bytes after skipping the desired amount and converts them to a string.
    `java.lang.Boolean` | `isDone()`
    `void` | `jumpBack(int amount)` Moves position back an amount of bytes.
    `abstract long` | `pos()`
    `abstract void` | `pos(long pos)`
    `int` | `read()` Reads in one integer and moves the position up one
    `java.lang.String` | `scanTo(java.lang.String... targets)` Uses an LStringSearcher to read file contents until one of the targets is found.
    `void` | `skip(int offset)` Bumps the position the desired offset.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LImport

          public LImport()

  - ### Method Detail

    - #### read

          public int read()

      Reads in one integer and moves the position up one
      Returns:

    - #### extractLong

          public final long extractLong(int skip,
                         int read)

      Reads in the desired bytes and converts them to a long (little endian assumed).
      Parameters:
        `skip` - Bytes to skip
        `read` - Bytes to read and convert
      Returns:
        Long representation of read bytes

    - #### extractString

          public final java.lang.String extractString(int skip,
                                       int read)

      Reads in the desired bytes and converts them to a string.
      Parameters:
        `skip` - Bytes to skip
        `read` - Bytes to read and convert
      Returns:
        String representation of read bytes

    - #### extractString

          public java.lang.String extractString(int amount)

      Extracts the specified number of bytes, and returns the string representation.
      Bumps the lower bound up so that following extracts do not extract the same data.
      Parameters:
        `amount` - Amount to read.
      Returns:
        String representation of the bytes read.

    - #### extractInt

          public final int extractInt(int skip,
                       int read)

      Reads in the desired bytes and converts them to a int (little endian assumed).
      Parameters:
        `skip` - Bytes to skip
        `read` - Bytes to read and convert
      Returns:
        Integer representation of read bytes

    - #### extractInt

          public final int extractInt(int read)

      Parameters:
        `read` -
      Returns:

    - #### extractIntSigned

          public final int extractIntSigned(int read)

      Reads in the desired bytes and converts them to a int (little endian assumed). Sign extends if less than 4 bytes were read and the number read is negative.
      Parameters:
        `read` -
      Returns:

    - #### extractInts

          public final int[] extractInts(int skip,
                          int read)

      Reads in the desired bytes and converts them to an int array.
      Parameters:
        `skip` - Bytes to skip
        `read` - Bytes to read and convert
      Returns:

    - #### extractInts

          public int[] extractInts(int amount)

      Extracts specified number of ints.
      Bumps the lower bound up so that following extracts do not extract the same data.
      Parameters:
        `amount` - Amount to read.
      Returns:
        int array containing desired offset.

    - #### getInts

          public final int[] getInts(int skip,
                      int read)

      Skips an amount of bytes, reads in amount of bytes and converts them to integers.
      Does NOT move position.
      Parameters:
        `skip` -
        `read` -
      Returns:

    - #### extractFloat

          public float extractFloat()

      Extracts 4 bytes and returns their float representation
      Bumps the lower bound up so that following extracts do not extract the same data.
      Returns:
        Float represented by the next 4 bytes.

    - #### extractBool

          public boolean extractBool(int amount)

      Parameters:
        `amount` -
      Returns:

    - #### extractAllBytes

          public byte[] extractAllBytes()

      Returns the remaining contents as a byte array, and adjusts bounds to be empty.
      Returns:
        The remaining contents as a byte array.

    - #### extractString

          public java.lang.String extractString()

      Reads in characters until a null byte (0) is read, and converts them to a string.
      Returns:
        Next string in the file.

    - #### extractAllString

          public java.lang.String extractAllString()

      Extracts the remaining data and returns it as a string.
      Returns:

    - #### extractLine

          public java.lang.String extractLine()

      Reads in a line until a newline character is found. (Byte of 10, or bytes 13 -> 10)
      Returns:

    - #### extractUntil

          public byte[] extractUntil(char delimiter,
                            int bufsize)

      Reads in bytes until the delimiter is read.
      Parameters:
        `delimiter` - char to stop reading at.
        `bufsize` - Buffer size to hold readings.
      Returns:
        Byte array containing read data without delimiter.

    - #### extractUntil

          public byte[] extractUntil(char delimiter)

      Reads in bytes until the delimiter is read.
      Parameters:
        `delimiter` - char to stop reading at.
      Returns:
        Byte array containing read data without delimiter.

    - #### extractUntil

          public byte[] extractUntil(int delimiter)

      Reads in bytes until the delimiter is read.
      Parameters:
        `delimiter` - int to stop reading at.
      Returns:
        Byte array containing read data without delimiter.

    - #### extract

          public byte[] extract(int skip,
                       int read)

      Skips an amount of bytes, reads in amount of bytes and converts them to integers.
      Moves position forward.
      Parameters:
        `skip` -
        `read` -
      Returns:

    - #### extract

          public abstract byte[] extract(int amount)

      Reads in amount of bytes and converts them to integers.
      Moves position forward.
      Parameters:
        `amount` -
      Returns:

    - #### getString

          public java.lang.String getString(int amount)

      Gets specified number of bytes and converts them to a string. Does not adjust bounds.
      Parameters:
        `amount` -
      Returns:

    - #### getString

          public java.lang.String getString(int skip,
                                   int amount)

      Gets specified number of bytes after skipping the desired amount and converts them to a string. Does not adjust bounds.
      Parameters:
        `skip` -
        `amount` -
      Returns:

    - #### extractUntil

          public byte[] extractUntil(int delimiter,
                            int bufsize)

      Reads in bytes until the delimiter is read.
      Parameters:
        `delimiter` - Byte to stop reading at.
        `bufsize` - Buffer size to hold readings.
      Returns:
        Byte array containing read data without delimiter.

    - #### extractUntil

          public byte[] extractUntil(byte[]... delimiters)

      Reads in bytes until any of the delimiters are read. Returns the first delimiter found, so parameter order matters.
      Parameters:
        `delimiters` - Byte arrays of patterns to stop reading at.
      Returns:
        Byte array containing read data without delimiter.

    - #### getBytes

          public byte[] getBytes(int skip,
                        int amount)

      Gets specified number of bytes after skipping the desired amount. Does not adjust bounds.
      Parameters:
        `skip` - Amount to skip.
        `amount` - Amount to read.
      Returns:
        byte array containing desired offset.

    - #### getAllBytes

          public byte[] getAllBytes()

      Returns the remaining contents as a byte array, but does NOT adjust the bounds.
      Returns:
        The remaining contents as a byte array.

    - #### skip

          public void skip(int offset)

      Bumps the position the desired offset.
      Parameters:
        `offset` - Desired offset.

    - #### jumpBack

          public void jumpBack(int amount)

      Moves position back an amount of bytes.
      Parameters:
        `amount` -

    - #### pos

          public abstract void pos(long pos)

      Parameters:
        `pos` -

    - #### pos

          public abstract long pos()

      Returns:
        @throws IOException

    - #### scanTo

          public final java.lang.String scanTo(java.lang.String... targets)

      Uses an LStringSearcher to read file contents until one of the targets is found.
      Parameters:
        `targets` -
      Returns:
        The target found, or the empty string if none found.

    - #### close

          public abstract void close()

    - #### available

          public abstract int available()

      Returns:
        @throws IOException

    - #### isDone

          public java.lang.Boolean isDone()

      Returns:

    - #### correctForCompression

          public LShrinkArray correctForCompression()
                                             throws java.util.zip.DataFormatException

      Assumes the contents of the ShrinkArray is raw zipped data in its entirety, and nothing else. It then unzips that data in the ShrinkArray.
      Returns:
        new ShrinkArray with uncompressed data.
      Throws:
        `java.util.zip.DataFormatException`