Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Reading dat input is very slow #2

@zeronymous

Description

@zeronymous

Running the demo app on an HTC One X, it takes roughly 60 seconds to initialize the DocumentReader.
This seems to be due to the loop in DocumentReader.java that reads the dat file one byte at a time:

 i = datInput.read();
while (i != -1)
{
      byteArrayOutputStream.write(i);
       i = datInput.read();
}        

The time required can be reduced to less than a second by replacing it with the following:

int avail = datInput.available();
byte[] dat = new byte[avail];
datInput.read(dat);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions