Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:31:05+00:00 2026-05-26T08:31:05+00:00

I have a couple of binary files that are used in image processing where

  • 0

I have a couple of binary files that are used in image processing where the data is in float form and is used frequently. The calculations include multiplication and addition of pixels from images taken by the camera.

At present the files are stored as Resources in the /res folder and I am using a DataInputStream each time the file is used, where the data is read and calculated in a single function.

I am relatively new to using files in applications, especially on Android, and so I wanted to find out if there is a better practice to getting data from a file, for instance as I am using the same data over and over again is it better to read the data and store it in an array or even in the SQLite database. This is a augmented reality application so the processed images need to be displayed in near real time.

Many thanks in advance.

EDIT: Thank you Patthoyts for your answer, on a different question however, Why people say mmap by MappedByteBuffer is faster?, I’ve read that using a MappedByteBuffer is not needed as I am reading my data sequentially each time. Could someone with experience on Android tell me whenever it is better to read the data in at the start and store it in a large array or buffer, or to keep reading it from a stream each time I need it. Overall I have around 50,000 floating point values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:31:05+00:00Added an answer on May 26, 2026 at 8:31 am

    You can use memory-mapped files on Android which means the data can be paged into memory by the OS for rapid access until something else needs memory. You need to copy your data file out of your res/raw or assets section to the data filesystem though but after that you can use a MappedByteBuffer to provide access. eg:

    FileInputStream inputstream = context.openFileInput(DATA_FILE_PATH);
    FileChannel channel = inputstream.getChannel();
    MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
    buffer.order(ByteOrder.LITTLE_ENDIAN);
    IntBuffer intbuffer = buffer.asIntBuffer();
    

    now access as sequence of integers using intbuffer.get(index) and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that stores large amount of files (XML and binary) in
I have an android application that uses a datastructure consisting couple of binary trees
I have couple resource DLLs that I currently load when application starts using following
ok I have couple of .NET classes that I want to use in VBA.
I have a couple of files containing a value in each line. EDIT :
I have a couple old services that I want to completely uninstall. How can
I have a couple of tables that are joined by GUIDs in SQL Server.
So I have a python script that relies on a couple modules. Specifically pexpect
I have an assembly that provides an API and is used by some other
I have a binary file that was created on a unix machine. It's just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.