title: documentation about the file format of spark rdd.saveAsObjectFile
body: <p>Spark can save a rdd to a file with <code>rdd.saveAsObjectFile("file")</code>.
  I need to read this file outside Spark. According to <a href="https://spark.apache.org/docs/latest/tuning.html#data-serialization" rel="nofollow noreferrer">doc</a>, using the default spark serializer, this file is just a sequence of objects serialized with the standard Java serialization. However, I guess the file has a header and a separator between objects. I need to read this file, and use <a href="https://github.com/unsynchronized/jdeserialize" rel="nofollow noreferrer">jdeserialize</a> to deserialize each Java/Scala object (as I don't have the class definition).</p>
  
  <p>Where can I find the documentation about the file format produced by <code>rdd.saveAsObjectFile("file")</code> (with the standard serializer, not Kryo serializer)?</p>
  
  <hr>
  
  <p><strong>Update</strong>
  Working example based on VladoDemcak answer:</p>
  
  <pre><code>import org.apache.hadoop.io._
  import org.apache.hadoop.conf._
  import org.apache.hadoop.fs._
  import org.apache.hadoop.io._
  
  def deserialize(data: Array[Byte]) =
    new ObjectInputStream(new ByteArrayInputStream(data)).readObject()
  
  val path = new Path("/tmp/part-00000")
  val config = new Configuration()
  val reader = new SequenceFile.Reader(FileSystem.get(new Configuration()), path, config)
  val key = NullWritable.get
  val value = new BytesWritable
  
  while (reader.next(key, value)) {
    println("key: {} and value: {}.", key, value.getBytes)
    println(deserialize(value.getBytes()))
  }
  reader.close()
  </code></pre>