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

  • Home
  • SEARCH
  • 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 6742987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:54:28+00:00 2026-05-26T11:54:28+00:00

The function simpleQueryForBlobFileDescriptor() in Android’s SQLiteStatement is a mystery to me. And no one

  • 0

The function simpleQueryForBlobFileDescriptor() in Android’s SQLiteStatement is a mystery to me. And no one seems to use it anywhere. It seems as though it would be a fast method for individual blob access and in terms of performance (if the documentation is to be believed) the combination of SQLiteStatement and Parcel should yield a very fast result when used to stream blob data out of a db. I don’t know because I can’t get the thing to work so that I could test… Any help with this or insight would be appreciated:

SQLiteStatement get = mDb.compileStatement(
    "SELECT blobColumn" + 
    " FROM tableName" +
    " WHERE _id = 1" +
    " LIMIT 1"
);

ParcelFileDescriptor result = get.simpleQueryForBlobFileDescriptor();
// now what?

I should probably note that I am using and only really care about Honeycomb (3.2) and thank you in advance for any insight.

  • 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-26T11:54:28+00:00Added an answer on May 26, 2026 at 11:54 am
    SQLiteStatement get = mDb.compileStatement(
        "SELECT blobColumn" + 
        " FROM tableName" +
        " WHERE _id = 1" +
        " LIMIT 1"
    );
    
    ParcelFileDescriptor result = get.simpleQueryForBlobFileDescriptor();
    FileInputStream fis = new FileInputStream(result.getFileDescriptor()); // read like any other
    

    and I can verify that this is very fast for my use cases.

    Where I found this particularly useful (if you need to create your own custom offline webview file cache like I did) was in the openFile override for a content provider where you can just return the descriptor straight up (or ideally override openTypedAssetFile())

    examples:
    files is a DB helper and getFileDescriptor(String) is similar to the code above

    public AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, android.os.Bundle opts) throws FileNotFoundException {
        ParcelFileDescriptor pfd = files.getFileDescriptor(uri.toString());
        if (pfd != null) {
            return new AssetFileDescriptor(pfd, 0, AssetFileDescriptor.UNKNOWN_LENGTH);
        }
        return null;
    }
    

    or another great use for a similar problem:
    (where you want to serve custom file from a db to a webview)

    private WebViewClient webViewClient = new WebViewClient() {
        @Override
        public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
    
            ParcelFileDescriptor pfd = files.getFileDescriptor(url);
            if (pfd != null) {
                return new WebResourceResponse(null, null, new FileInputStream(pfd.getFileDescriptor()));
            }
    
            return null; 
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function strip_cdata($string) { preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches); return str_replace($matches[0], $matches[1], $string); } I use the
function ajaxCall(query){ $.ajax({ method:get, url:/main/, data:q=+query, beforeSend:function() {}, success:function(html){ $(#main).html(html); } }); }; This
function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; generates a syntax
Function FillAdminAccount() As Boolean FillAdminAccount = True Try SQLconn.ConnectionString = connect timeout=9999999; & _
function Submit_click() { if (!bValidateFields()) return; } function bValidateFields() { /// <summary>Validation rules</summary> ///
function main() { Hello(); } function Hello() { // How do you find out
function AddTheatres() { Services.AdminWebServices.AddTheatresSVC(oTheatres, OnSuccessTheatres, OnError, OnTimeOut); } function OnSuccessTheatres(result1) { Services.AdminWebServices.AddTicketPricesSVC(oTicketPrices, OnSuccessTicketPrices, OnError,
function holiday_hitlist($tablename, $hit_user){ global $host, $user, $pass, $dbname; $link = mysql_connect($host, $user, $pass, $dbname);
function register_contact ($person = array()) { $nogood = false; foreach ($person as $val) {
function get_total_adults() { $sql = SELECT SUM(number_adults_attending) as number_of_adults FROM is_nfo_rsvp; $result = mysql_query($sql)

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.