Creating Java DataInputStream data in Python
<p>I have a Java program that uses a <code>DataInputStream</code> for storing object data. </p>

<p>Example:</p>

<pre><code>  DataInputStream tInput = new DataInputStream(getClass().getResourceAsStream(aDirectory + "/ResultItemInfo.dat"));

  this._text = tInput.readUTF();

  this._image = tInput.readUTF();

  this._audio = tInput.readUTF();

  this._random = false;
  if (tInput.read() == 1) {
    this._random = true;
  }

  this._hasMenu = false;
  if (tInput.read() == 1) {
    this._hasMenu = true;
  }
</code></pre>

<p>Nice, isn't it?</p>

<p>There is an existing dataset, and now I have to add some records. If the tool that I am required to make was written in Java too, this would be pretty easy. Unfortunately, it is written in Python, so I have to discover a way how to create files that can be read from the Java application using Python.</p>

<p>Is there any easy way to do this?</p>

<p>As a last resort, I could:</p>

<ul>
<li>Modify the Java app and use XML. This would break compatibility with all existing data, so I really don't want to do it.</li>
<li>Use Jython. Possible solution, but I want pure C-Python.</li>
<li>Reverse-Engineer the data format. Not a good solution either.</li>
</ul>
