Created
December 27, 2009 21:14
-
-
Save rombert/264403 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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