Skip to content

bigger files in sqlite#165

Open
krisoft wants to merge 1 commit intopurgatoryfrom
aeroglass-bigger-sqlite
Open

bigger files in sqlite#165
krisoft wants to merge 1 commit intopurgatoryfrom
aeroglass-bigger-sqlite

Conversation

@krisoft
Copy link
Copy Markdown

@krisoft krisoft commented Jan 4, 2016

Added ability to the android sql cache store to be able to contain bigger data files by saving them separately and saving a pointer into the database.

(This has been broken out from #153)

…gger data files by saving them separately and saving a pointer into the database
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quiet sure this use of available() method is wrong.

Take a look to this:
https://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html#available()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need something like:

   public static byte[] readAll(final InputStream is) throws IOException {
      final ByteArrayOutputStream result = new ByteArrayOutputStream();
      final byte[] buffer = new byte[16384];
      int read;
      while ((read = is.read(buffer, 0, buffer.length)) != -1) {
         result.write(buffer, 0, read);
      }
      result.flush();
      return result.toByteArray();
   }


   public static byte[] readAll(final File file) throws IOException {
      try (final FileInputStream is = new FileInputStream(file)) {
         return readAll(is);
      }
   }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much @DiegoGomezDeck! Looks very much like you are right. I will consult with @DrakkLord and one of us will fix this.

@DiegoGomezDeck
Copy link
Copy Markdown
Member

@krisoft any advances in this PR?

@krisoft
Copy link
Copy Markdown
Author

krisoft commented Feb 16, 2016

It's in our worklog, but the feature on our side which depends on this got a lower priority. So it might take a while until we come around fixing the issues you so kindly pointed out for us. I hope that doesn't cause any trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants