title: How do I generate reports in Java?
body: <p>How do I generate reports in Java using IO? </p>
  
  <p>I want to generate PDF files with database records.</p>
  
  <p>At the moment I have something like this...</p>
  
  <pre><code>try{
      ResultSet rs = ps.executeQuery();
      while(rs.next()){
      FileOutputStream fos = new FileOutputStream("Desktop/Test.pdf");
      ObjectOutputStream out = new ObjectOutputStream(fos);
      out.writeChars("Name of user: ");
      out.writeChars("Age: ");
      out.close();
  }
  }
      catch (IOException ioe){
      }
  </code></pre>
  
  <p>It keeps saying that the PDF file is corrupted.</p>
  
  <p>I would greatly appreciate it if someone could help me out here.</p>
  
  <p>Edit: I do not want to use iReports/JasperReports/iText/other report generators.</p>
  
  <p>Many thanks</p>