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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:11:28+00:00 2026-05-23T08:11:28+00:00

I am sending a file in byte[] format from web service to android device.

  • 0

I am sending a file in byte[] format from web service to android device.

  1. If that file is an XML file i.e. byte[] array then how could i convert it to original XML file.
  2. If that file is an image i.e. byte[] array then how could i convert it to original Image.

I am using android sdk 2.2 on samsung galaxy tab.

  • 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-23T08:11:29+00:00Added an answer on May 23, 2026 at 8:11 am

    Your Webservice should send you some identifier about the file type. whether the byte array is for image or is for general file. then only you can know about which type of file it is. after knowing file type you can convert the byte array into your desired file type. Also you can write to file. If you want to print that xml in logcat you can use

    String xmlData = new String(byte[] data); System.out.println(xmlData)
    

    create a file (whether xml or image or anything) if you know the file format

    String extension = ".xml"//or ".jpg" or anything
    String filename = myfile+extension;
    byte[] data = //the byte array which i got from server
    File f = new File(givepathOfFile+filename );
    
            try {
                f.createNewFile();
    
                // write the bytes in file
                FileOutputStream fo = new FileOutputStream(f);
                fo.write(data );
                fo.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    

    Thanks
    Deepak

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

Sidebar

Related Questions

I write a client-server application which will be sending an .xml file from the
We're using a 3rd party XML messaging service that requires an embedded PDF file
I have a simple question about sending a file (XML file) from my webapp
I am sending a filename(string), filesize(int), and the file(byte[]). What is happening is that
I have got following code witch are sending xml file on HTTP protocol and
I'm generating HTML from a database and then sending it to PrinceXML for conversion
I'm sending an image file from an iPhone application to a http Post application.
I have a mostly ascii data file (10+ gigs) that uses byte x03 instead
I am wanting to write a WCF web service that can send files over
I am sending an image from android phone to the server which hanldes it

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.