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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:01:11+00:00 2026-06-15T17:01:11+00:00

Is it possible to convert an audio mp3 file to a string data for

  • 0

Is it possible to convert an audio mp3 file to a string data for sending data to the server,
and server will return a string data to my app i want to convert that data to mp3 file and play audio.

I am using this code to convert mp3 file to string data

public static String readFileAsString(String filePath) throws java.io.IOException {

    BufferedReader reader = new BufferedReader(new FileReader(filePath));
    String line, results = "";
    while( ( line = reader.readLine() ) != null)
    {
        results += line;
    }
    reader.close();
    return results;

}

i don’t know how to get back my mp3 file from converted strind data.

If possible then how ? anybody help me.

Or any other solution for this requirement tell me: i want to pass audio and video files to server and get back from the server to use in app.

  • 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-06-15T17:01:12+00:00Added an answer on June 15, 2026 at 5:01 pm

    use Base64.encodeToString() try this http://developer.android.com/reference/android/util/Base64.html#encodeToString%28byte%5B%5D,%20int%29

    File file = new File(Environment.getExternalStorageDirectory() + "/hello-4.wav");
    byte[] bytes = FileUtils.readFileToByteArray(file);
    
    String encoded = Base64.encodeToString(bytes, 0);                                       
    Utilities.log("~~~~~~~~ Encoded: ", encoded);
    
    byte[] decoded = Base64.decode(encoded, 0);
    Utilities.log("~~~~~~~~ Decoded: ", Arrays.toString(decoded));
    
    try
    {
        File file2 = new File(Environment.getExternalStorageDirectory() + "/hello-5.wav");
        FileOutputStream os = new FileOutputStream(file2, true);
        os.write(decoded);
        os.close();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    
    
    
    public class FileUtils {
    
        /**
         * Instances should NOT be constructed in standard programming.
         */
        public FileUtils() { }
    
        /**
         * The number of bytes in a kilobyte.
         */
        public static final long ONE_KB = 1024;
    
        /**
         * The number of bytes in a megabyte.
         */
        public static final long ONE_MB = ONE_KB * ONE_KB;
    
        /**
         * The number of bytes in a gigabyte.
         */
        public static final long ONE_GB = ONE_KB * ONE_MB;
    
    
    
        public static String readFileToString(
                File file, String encoding) throws IOException {
            InputStream in = new java.io.FileInputStream(file);
            try {
                return IOUtils.toString(in, encoding);
            } finally {
                IOUtils.closeQuietly(in);
            }
        }
    
    
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert a string into audio stream to play the string
Possible Duplicate: Convert String to another locale in java I want to convert a
Possible Duplicate: Convert a number to the shortest possible character string while retaining uniqueness
Is it possible to convert a String to a type, which is definied by
Is it possible to convert HTML + CSS into HTML for a system that
Is it possible to convert facebook data (ex. user_pic) into a DisplayObject so I
I want to upload any audio file and want the out put in the
Possible Duplicate: Convert flat array [k1,v1,k2,v2] to object {k1:v1,k2:v2} in JavaScript? I want to
Possible Duplicate: convert string to 2D array using php I have the string like
Is there a way in C# to play audio (for example, MP3) direcly from

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.