Android: Download Object
<p>So I am trying to download and load an object from a file stored on a webserver. The code I use is inside a try-catch block in an AsyncTask:</p>

<pre><code>URL url = new URL("http://www.mydomain.com/thefileIwant");
URLConnection urlConn = url.openConnection();
ObjectInputStream ois = new ObjectInputStream(urlConn.getInputStream());
foo = (Foo) ois.readObject();
ois.close();
</code></pre>

<p>I build the file with this code:</p>

<pre><code>ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("thefileIwant"));
oos.writeObject(foo);
oos.close();
</code></pre>

<p>When I try and read the object in the first piece of code I get an IOExecption that the UTF Data Format does not match UTF-8. I have tried re-building the file a couple of times and it always gives me the same error. Can I download an Object like this?</p>
