title: How to read content of an RPM in java
body: <p>I'm looking for a way to read an RPM's content in java runtime.</p>
  
  <p>Someone has suggested using 7zip to unpack and/or extract the RPM in runtime, using system command for 7zip.</p>
  
  <p>that solution has two cons:</p>
  
  <ol>
  <li>It is platform dependent (since the commands will be specific to one OS)</li>
  <li>It involved third party software.</li>
  </ol>
  
  <p>any ideas?</p>
  
  <p><strong>EDIT :</strong><br/>
  I'm trying to go down Robert's road. Here is my code:</p>
  
  <pre><code>String file = "MyRpm.rpm";
  
  CpioArchiveInputStream cpioIn = 
         new CpioArchiveInputStream( new FileInputStream(new File(file)) );
   CpioArchiveEntry cpioEntry;
  
  
  
  while ((cpioEntry = cpioIn.getNextEntry()) != null)
  {
      System.out.println(cpioEntry.getName());
      int tmp;
      StringBuffer buf = new StringBuffer();
      while ((tmp = cpioIn.read()) != -1)
      {
          buf.append((char) tmp);
      }
      System.out.println(buf.toString());
  }
  cpioIn.close();
  </code></pre>
  
  <p>I'm getting an exception: <code>java.io.IOException: Unknown magic [????</code> (The funny characters are from the original error message).</p>