Convertir byte[] en UTF8 a un String en Java

Posted on Marzo 8, 2008. Filed under: Java | Tags: , , , , |

Para convertir una cadena de bytes codificados en UTF8 a un String usamos el siguiente constructor de String:


new String(by, “UTF8");

De forma que si le pasamos, por ejemplo, un array de bytes:

6a 61 76 61 2f 6c 61 6e 67 2f 43 6c 61 73 73

obtendremos

java/lang/Class

Hasta la próxima

Make a Comment

Make A Comment: ( None so far )

blockquote and a tags work here.

Liked it here?
Why not try sites on the blogroll...