title: Convert byte[] to List<Map<String, Object>>
body: <p>I am able to convert <code>List&lt;Map&lt;String,Object&gt;&gt;</code> to <code>byte[]</code>,<br>
  But when I convert <code>byte[]</code> back to <code>List&lt;Map&lt;String,Object&gt;&gt;</code> it gives only first object(key, value pair)</p>
  
  <p>How do I iterate through byte array or ObjectOutputStream?  </p>
  
  <p>However, I tried <code>while (ObjectOutputStream#available() &gt; 0 )</code> but <code>ois.available()</code> returns <code>0</code></p>
  
  <pre><code>public class MyClass {
      public static void main(String args[]) {
          List&lt;Map&lt;String, Object&gt;&gt; list = new ArrayList&lt;&gt;();
          Map&lt;String, Object&gt; map = new HashMap&lt;&gt;();
          map.put("age", 12);
          map.put("name","gh");
          list.add(map);
  
          Map&lt;String, Object&gt; map1 = new HashMap&lt;&gt;();
          map1.put("age", 20);
          map1.put("name","ty");
          list.add(map1);
          System.out.println(convertToObject(convertToByteArray(list)));
      }
  
      private static byte[] convertToByteArray(List&lt;Map&lt;String, Object&gt;&gt; resultSet) {
          ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
          try {
              ObjectOutputStream out = new ObjectOutputStream(byteOut);
              for (Map&lt;String, Object&gt; map : resultSet) {
                  out.writeObject(map);
              }
          } catch (IOException e) {
              e.printStackTrace();
          }
          return byteOut.toByteArray();
      }
      private static Object convertToObject(byte[] byteArr){
          Object obj = null;
          ByteArrayInputStream bis = null;
          ObjectInputStream ois = null;
          try {
              bis = new ByteArrayInputStream(byteArr);
              ois = new ObjectInputStream(bis);
              obj = ois.readObject();
          } catch (IOException | ClassNotFoundException e) {
              e.printStackTrace();
         } 
         return  obj;
      }
  }
  </code></pre>