Skip to content

Instantly share code, notes, and snippets.

@rombert
Created December 27, 2009 21:14
Show Gist options
  • Save rombert/264403 to your computer and use it in GitHub Desktop.
Save rombert/264403 to your computer and use it in GitHub Desktop.
import java.io.*;
import java.util.Locale;
public class LocaleSerialisation {
public static void main(String[] args) throws IOException, ClassNotFoundException {
Locale toWrite = new Locale("en", "EN");
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
ObjectOutputStream output = new ObjectOutputStream(byteOutput);
output.writeObject(toWrite);
ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(byteOutput.toByteArray()));
Locale read = (Locale) input.readObject();
Locale fresh = new Locale("en", "EN");
assert read.equals(fresh);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment