Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

How to convert Byte array to String type

Thread view: 
peeushonline@gmail.com - 11 Apr 2007 17:16 GMT
During a project dealing with encryption and decryption in password
based encryption, I'm facing a problem while reading a Byte array.
When the size of the string input during the encryption is small then
both the decryption and the string shown are correct but when the
string is large it shows error.

byte[] textTranslated = pbeCipher.doFinal(textInBytes);
return new String(textTranslated);

by using this code i'm not getting the full string when its large.
So tell me how to convert a byte array to string and read
successfully.
Pls Help. Thanx in advance.
Andrew Thompson - 11 Apr 2007 18:29 GMT
>During a project dealing with encryption and decryption in password
>based encryption, I'm facing a problem while reading a Byte array.
>When the size of the string input during the encryption is small then
>both the decryption and the string shown are correct but when the
>string is large it shows error.

Would that be a TimeTurnsKittensIntoCatsError?
Or would you just like us to guess?
<http://www.physci.org/codes/javafaq.html#exact>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Martijn - 11 Apr 2007 18:41 GMT
To answer the question in your subject:

Simply use the appropriate String constructor.  But be aware of code pages
and the sorts.

More details here:

   http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[])

Signature

Martijn
http://www.sereneconcepts.nl



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.