title: StreamCorruptedException when reading an object from string
body: <p>Here's my code: </p>
  
  <pre><code> try {
  
                  Uri uri = Uri.parse("file:///storage/emulated/0/Download/information.csv");
                  File file = new File(uri.getPath());
                  //Read the file
                  BufferedReader br = new BufferedReader(new FileReader(file));
                  String line;
                  boolean firstLine = true;
  
                  while ((line = br.readLine()) != null) {
                      System.out.println("Print the contents from the file :" + line);
                      if (firstLine) {
                          firstLine = false;
                          continue;
                      } else {
  
                              //deserialize the string to Object
                              td = TransferData.fromString(line); //Where td is an object 
  
                              //deserialize the string to Object
                              System.out.println("deserialized: " + td);
  
  
  
                 }
  </code></pre>
  
  <p>However, I get an exception on this line:  </p>
  
  <pre><code>td = TransferData.fromString(line);
  </code></pre>
  
  <p>and from my fromString function: </p>
  
  <pre><code>/** Read the object from Base64 string. */
      public static TransferData fromString( String s ) throws IOException, ClassNotFoundException     {
          byte [] data = Base64.decode(s, Base64.DEFAULT);
          ObjectInputStream ois = new ObjectInputStream(
                  new ByteArrayInputStream(  data ) );
          Object o  = ois.readObject();
          ois.close();
          return (TransferData)o;
      }
  </code></pre>
  
  <p>The exception is StreamCorruptedException but I'm not sure why that is. I want to be able to read in a string and deserialize the string. </p>
  
  <p>EDIT: </p>
  
  <pre><code>  /** Write the object to a Base64 string. */
      public static String toString(Serializable o) throws IOException {
          ByteArrayOutputStream output = new ByteArrayOutputStream();
          ObjectOutputStream oos = new ObjectOutputStream(output);
          oos.writeObject(o);
          oos.close();
          return new String(Base64.encode(output.toByteArray(), Base64.DEFAULT));
      }
  
  
  
  //SerialVersionID
    private static final int serialVersionUID = 10032014;
  </code></pre>