Decompressão de um String
Página 1 de 1 • Compartilhe •
Decompressão de um String
Relacionado com o tópico anterior...
import java.util.zip.Inflater;
....
public static String uncompress2( byte[] b ) {
Inflater infl = new Inflater();
infl.setInput( b );
StringBuffer retval = new StringBuffer();
boolean done = false;
while (!done) {
byte[] buf = new byte[256];
try {
int bufnum = infl.inflate( buf );
retval.append( new String( buf, 0, bufnum ) );
if ( bufnum < buf.length )
done = true;
} catch( DataFormatException dfe ) {
dfe.printStackTrace();
done = true;
}
}
return(retval.toString());
}
import java.util.zip.Inflater;
....
public static String uncompress2( byte[] b ) {
Inflater infl = new Inflater();
infl.setInput( b );
StringBuffer retval = new StringBuffer();
boolean done = false;
while (!done) {
byte[] buf = new byte[256];
try {
int bufnum = infl.inflate( buf );
retval.append( new String( buf, 0, bufnum ) );
if ( bufnum < buf.length )
done = true;
} catch( DataFormatException dfe ) {
dfe.printStackTrace();
done = true;
}
}
return(retval.toString());
}
Admin- Admin
- Mensagens : 598
Data de inscrição : 21/01/2008
Idade : 40

» Inserir somente uma Aspa dupla numa String
» Contar retornar números de uma string
» [Resolvido]Como pegar apenas um trecho de uma string?
» Pegar o texto entre tags!
» [Script]IsEmail(string)
» Contar retornar números de uma string
» [Resolvido]Como pegar apenas um trecho de uma string?
» Pegar o texto entre tags!
» [Script]IsEmail(string)
Página 1 de 1
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum
» Regular expressions
» Novo site para desportistas / New site for athletes
» List files by date
» RegExp - Add XXX to the begin of a String
» RegExp - Add XXX to the end of a String
» Great book about DOD programming
» MESOS (Apache)
» Site de aluguer entre particulares