simple Base64

Put your problem here if it does not fit any of the other categories.

simple Base64

Postby isaackearl » Fri Mar 20, 2009 7:08 pm

I absolutely cannot figure this out. help me out if you can, I know its simple.

I just want to take a string and encode it.. then decode it using base 64.... and put it back in a string...

i download the org.apache.commons.codec.binary.Base64 library... but i don't care which library i get it done with.

thanks in advance,
isaac
isaackearl
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Nov 25, 2008 8:09 pm

Top

no library

Postby Dayn » Fri Aug 14, 2009 1:25 pm

Hi izsaak

I have an issu to decode à base64 String.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. byte[] decoded = Base64.decode( tabMsg[0].getMsgBase64() );
  2.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


And after I try to make a file but there is an issu

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.   File oText = new File("Filetxt64");          
  2.                 FileOutputStream fStream = new FileOutputStream(oText);
  3.             fStream.write(decoded);
  4.             fStream.close();
  5.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But I didn't use any library, I just use Base64 class.

could you help me :

I want no what I can make with my decoded Byte[] . my base 64 encoded is an WAV file.




Code: Select all
08-14 12:01:18.123: WARN/System.err(843): java.io.FileNotFoundException: /Filetxt64
08-14 12:01:18.150: WARN/System.err(843):     at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:231)
08-14 12:01:18.170: WARN/System.err(843):     at java.io.FileOutputStream.<init>(FileOutputStream.java:96)
08-14 12:01:18.180: WARN/System.err(843):     at java.io.FileOutputStream.<init>(FileOutputStream.java:69)
08-14 12:01:18.193: WARN/System.err(843):     at com.dany.android.socketinterface.Client.start(Client.java:349)
08-14 12:01:18.221: WARN/System.err(843):     at com.dany.android.socketinterface.TabVoicemail.onCreate(TabVoicemail.java:51)
08-14 12:01:18.231: WARN/System.err(843):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-14 12:01:18.250: WARN/System.err(843):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
08-14 12:01:18.262: WARN/System.err(843):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:2112)
08-14 12:01:18.272: WARN/System.err(843):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
08-14 12:01:18.280: WARN/System.err(843):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
08-14 12:01:18.301: WARN/System.err(843):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:600)
08-14 12:01:18.301: WARN/System.err(843):     at android.widget.TabHost.setCurrentTab(TabHost.java:310)
08-14 12:01:18.322: WARN/System.err(843):     at android.widget.TabHost.addTab(TabHost.java:203)
08-14 12:01:18.352: WARN/System.err(843):     at com.dany.android.socketinterface.InterfaceGraphiqueVVM.onCreate(InterfaceGraphiqueVVM.java:24)
08-14 12:01:18.371: WARN/System.err(843):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-14 12:01:18.382: WARN/System.err(843):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
08-14 12:01:18.403: WARN/System.err(843):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
08-14 12:01:18.420: WARN/System.err(843):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
08-14 12:01:18.440: WARN/System.err(843):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
08-14 12:01:18.461: WARN/System.err(843):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-14 12:01:18.472: WARN/System.err(843):     at android.os.Looper.loop(Looper.java:123)
08-14 12:01:18.490: WARN/System.err(843):     at android.app.ActivityThread.main(ActivityThread.java:3948)
08-14 12:01:18.501: WARN/System.err(843):     at java.lang.reflect.Method.invokeNative(Native Method)
08-14 12:01:18.521: WARN/System.err(843):     at java.lang.reflect.Method.invoke(Method.java:521)
08-14 12:01:18.540: WARN/System.err(843):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-14 12:01:18.551: WARN/System.err(843):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-14 12:01:18.561: WARN/System.err(843):     at dalvik.system.NativeStart.main(Native Method)


Dayn
User avatar
Dayn
Developer
Developer
 
Posts: 31
Joined: Thu Jul 09, 2009 10:45 am
Location: Paris and Dijon

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests