Class TPKBundle.SequentialInputFile

  • Enclosing class:
    TPKBundle

    public class TPKBundle.SequentialInputFile
    extends Object
    This object is used to manage the bundle data file and the bundle index file. We are using the InputStream object returned by ZipFile.getInputStream(ZipEntry) to read data from these files. The idea is to read in a forward direction (skipping bytes appropriately) whenever possible. If the request is for an offset that is "behind" our current position the object will close the current InputStream, get a "new" one and satisfy the read request.
    • Method Detail

      • read

        public byte[] read​(long offset,
                           int length)
        At a given offset read a given number of bytes and returned them as a new byte array
        Parameters:
        offset - -- where in the stream to start reading
        length - -- how many bytes to read
        Returns:
        -- a byte array of "length" bytes