"Deserializando" um objecto
Página 1 de 1 • Compartilhe •
"Deserializando" um objecto
- Código:
try {
// Deserialize de um ficheiro
File file = new File("file.ser");
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
// Deserialize the object
javax.swing.JButton button = (javax.swing.JButton) in.readObject();
in.close();
// Get some byte array data
byte[] bytes = getBytesFromFile(file);
// Deserialize de um byte array
in = new ObjectInputStream(new ByteArrayInputStream(bytes));
button = (javax.swing.JButton) in.readObject();
in.close();
} catch (ClassNotFoundException e) {
} catch (IOException e) {
}
Admin- Admin
- Mensagens : 598
Data de inscrição : 21/01/2008
Idade : 40

» Não diga "NÃO"
» Shadow The Hedgehog canta "Paint It Black"
» Porque eu odeio fóruns "gigantes"
» GTA V "confirmado"
» "Roubar" 12 volt à CR 250
» Shadow The Hedgehog canta "Paint It Black"
» Porque eu odeio fóruns "gigantes"
» GTA V "confirmado"
» "Roubar" 12 volt à CR 250
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