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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:11:52+00:00 2026-05-22T23:11:52+00:00

I want to take xml from internet, but everytime taking xml from net makes

  • 0

I want to take xml from internet, but everytime taking xml from net makes slow to my application, so i am thinking to take and save in local directory and next time i open app then at back end the xml again copied from internet to my xml

how to do that, and is there any other good way to solve this problem?

  • 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-22T23:11:53+00:00Added an answer on May 22, 2026 at 11:11 pm

    Please the use the following function to write the file to SD card.

        private  static String APP_DOC_DIR =  "file:///SDCard/BlackBerry/documents/MyAPP/";
    
    public static void writeToSD(String fileName, String fileContent){
        FileConnection fconn = null;
            // APP_DOC_DIR is the directory name constant.
        try {
             FileConnection fc = (FileConnection)Connector.open(APP_DOC_DIR);
         // If no exception is thrown, the URI is valid but the folder may not exist.
         if (!fc.exists())
         {
             fc.mkdir();  // create the folder if it doesn't exist
         }
         fc.close();
    
    
            fconn = (FileConnection) Connector.open(APP_DOC_DIR + fileName ,Connector.READ_WRITE);          
            if (!fconn.exists()) {
                fconn.create();
            }
            fconn.setReadable(true);
            fconn.setWritable(true);
            OutputStream os = fconn.openOutputStream();
            os.write(fileContent.getBytes("UTF8"));
            os.flush();
            os.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fconn!=null) {
                try {
                    fconn.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    

    Read file from SD Card is follows.

    public static String readFromSD(String fileName)
        {
            String resultString = "";
            int BUFFER_SIZE = 10000;
            InputStream inputStream = null;
            FileConnection fconn;
            try {
                fconn = (FileConnection) Connector.open( APP_DOC_DIR + fileName, Connector.READ);
                if (fconn.exists()) 
                {
                    inputStream = fconn.openInputStream();
                }
                else
                {
                    return "";
                }
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                byte[] buffer = new byte[BUFFER_SIZE];
                while (true) {
                    int bytesRead = inputStream.read( buffer, 0, BUFFER_SIZE );
                    if (bytesRead == -1)
                            break;
                    byteArrayOutputStream.write( buffer, 0, bytesRead );
                }
                byteArrayOutputStream.flush();
                byte[] result = byteArrayOutputStream.toByteArray();
                byteArrayOutputStream.close();
                //resultString = new String(result,"UTF8");
                resultString = new String(result);
    
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return resultString;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to save records fetched from database in an XML file, take x
We want to take XML data and convert it to an NSDictionary object, but
Background: I want to take some xml from one file, put it in a
I want to copy the xml file from server to save it to locally,
I want to take an XML file and replace an element's value. For example
I want to take a file from disk and upload it into an Oracle
I want to take a series of xml files and pull the xml of
in a web application, i want to insert the XML file content into an
I want to get an array of strings reading from arrays.xml file we add
I want to create gallery application which would get thumbnails and metadata from web

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.