Creating multiple files dynamically and storing different message in each file
<pre><code>public static void record(Message  message)//Message is a class 
    {
    try
      {
        BufferedOutputStream buf=new BufferedOutputStream(new      FileOutputStream("E:/kruthika/proj/a.bin"));
        byte[] b =serializer.serialize(message);        
        buf.write(b);
        buf.flush();


      }
    catch(Exception e){System.out.print(e);}
  }
</code></pre>

<p>this is a small code which serializes my message object(this object contains some text message) and writes it to a binary file. This works perfectly if the object carries only one word for a text but if many words are sent, obviously it is overwritten in the binary file. So how do i alter the snippet to create multiple files dynamically and then store different message in different file?  </p>
