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 6567029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:17:17+00:00 2026-05-25T14:17:17+00:00

I have an InputStream that gets passed to an InputSource: int resID = getResources().getIdentifier(c

  • 0

I have an InputStream that gets passed to an InputSource:

int resID = getResources().getIdentifier("c" + getCfrFile(), "raw", getPackageName());  
InputStream ins  = getResources().openRawResource(resID); 
InputSource xmlSource = new InputSource(ins);   

xmlTableRowLoader = new AcmTableRowLoader(handler, xmlSource, this, pathBuilder(false), "title");

How do I properly close() the InputStream? When I try to close it:

ins.Close();

I get an java.lang.NullPointerException because the stream gets closed before the “xmlSource” is finished with it. Also the object “xmlTableRowLoader” extends Thread.

  • 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-25T14:17:17+00:00Added an answer on May 25, 2026 at 2:17 pm

    That depends on how AcmTableRowLoader is using it. If it is only using it in its constructor, which I doubt from what you said, then closing it in the method above might be valid. However, since it appears that AcmTableRowLoader is using it in places other than the constructor… I would suggest having the AcmTableRowLoader create and close the stream itself since it knows when it is done with it.

    Or in short, close it after you have closed the xmlSource. Hard to tell exactly where / how without more context. Looks like you just jumped the gun.

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

Sidebar

Related Questions

If you have a java.io.InputStream object, how should you process that object and produce
I have an InputStream that is set up to handle local files, but want
Suppose I have an InputStream that contains text data, and I want to convert
I have an InputStream that is returning, for example: <?xml version='1.0' ?><env:Envelope xmlns:env=http://schemas.xmlsoap.org/soap/envelope/><bbs:rule xmlns:bbs=http://com.foo/bbs>
I have an InputStream that would read from a text file. I noticed that
I have a processor component that can process a single File, InputStream, Reader, or
i have a IcyStreamMeta.class that gets the metadata info of shoutcast Stream i use
I have an activity that gets a bitmap from the sdcard. Its view is
Should be pretty simple: I have an InputStream where I want to peek at
I have this line in my program : InputStream Resource_InputStream=this.getClass().getClassLoader().getResourceAsStream(Resource_Name); But how can I

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.