ObjectOutputStream

The document says "An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream."
what does "graph" mean?

In simpler terms , it will write the Object and all the associated objects also to the stream for example
class Student{
  String name;
  Account account;
class Account{
   int id;
   Date beginDate;
Student someStudent = xxxx;
The graph at runtime would look like this
    someStudent(someStudent)   
      |
      |----------->name(String)
      |
      |
     account(Account)
       |
       ----->beginDate(Date) 
  

Similar Messages

  • Writing to file with ObjectOutputStream

    ApartmentWriterProgram asks information about apartments
    and saves it to a file.
    For some reason it doesnt save information, it writes:
    Writing to file "+file+ " failed.
    So there happens IOException in the method write(Apartment apartment).
    Or in the run().
    I dont know what's wrong. Do you?
    public class ApartmentFileHandler extends Object implements Serializable {
        private OutputStream outStream;
        private ObjectOutputStream obStream;
        private String filePath;
            public ApartmentFileHandler(String filePath) {
               this.filePath = filePath;
    /** Writes the given apartment data in the file. If the file already
    exists, the old contents are overwritten.
    Parameters:
    apartment - the apartment to be written in the file
    Throws:
    IOException - if other problems arose when handling the file (e.g. the
    file could not be written)
            public void write(Apartment apartment)
               throws IOException {
               outStream = new FileOutputStream(filePath);
               obStream = new ObjectOutputStream(outStream);
               obStream.writeObject(apartment);
    import java.io.*;
    import java.util.*;
    public class ApartmentWriterProgram
    extends Object
        private KeyboardReader keyboardReader;
        private List roomsInList;
        private Room[] rooms;
        private int numberOfRooms;
        private String file;
              public ApartmentWriterProgram()
                this.keyboardReader = new KeyboardReader();
                this.roomsInList = new ArrayList();
                this.rooms = new Room [numberOfRooms];
    /** Runs the writer program. The program asks the user for some
    apartment data and a file name, and saves the data in the file. */
              public void run() {
                try {
                  numberOfRooms = keyboardReader.getInt("Give number of rooms: ");
                  for (int i =1; i<numberOfRooms+1; i++) {
                     String type =keyboardReader.getString("Give " +i+ ". " + "type of the room: ");
                     double area =keyboardReader.getDouble("Give " +i+ ". " + "area of room: ");
                     Room room= new Room(type, area);
                     this.roomsInList.add(huone);
                  roomsInList.toArray(rooms);
                  Apartment apartment = new Apartment(rooms);
                  System.out.println();
                  file = keyboardReader.getString("Give name of the file: ");
                  ApartmentFileHandler handler = new ApartmentFileHandler(file);
                  handler.write(apartment);
               } catch (IOException ioe) {
                 System.out.println("Writing to file "+file+ " failed.");
             public static void main(String[]  args) {
                  ApartmentWriterProgram program = new ApartmentWriterProgram();
                  program.run();
    }

    There is nothing to gain in not putting the throws IOException in the write method, since the exception object will have the information about the actual problem.
    Is this a typo for the this post?                 this.roomsInList.add(huone); should be room nes pas.
    What exception is actually thrown? To find out useSystem.out.println("Exception: " + ioe);Then wonder why you have the AppartmentFileHandler implement Serializable when you are not writing that object to the file.

  • I have problem using ObjectOutputStream with Multi-Thread

    I am writing a network rpg game for the project.
    Because it is a network game, so i use thread to support multi-user.
    When i using the string to store the command, and send to the server,
    it still can work. You can downlod at http://ivebug.tripod.com/new-string.zip
    (You cannot click the link, you must use [save target as] to save the file)
    1. First compile the files then "java ChatServer",
    2. Then you can execute "java ChatClient".
    3. Input the name for username in the textfield and then press 'login button'.
    4. A small square appear in the up-left corner.
    5. Then you can click in the black panel to move the square.
    6. If you want more than one square can be move, go step 2 to step 5 again.
    It seems everthing is work, but i want more extention for future.
    So i change to use object to encapsulate the command.
    However, it can't work. It stops working after create the socket and
    it can can't run to the line to create an ObjectInputStream and ObjectOutputStream. I don't know why. Who can tell me.
    The program using object at http://ivebug.tripod.com/new-object.zip
    (You cannot click the link, you must use [save target as] to save the file)

    Thank you for solve my problem.
    Now, i can send the object though the socket, however new problem occurs.
    The problem is that after i sent the 'login' object to server,
    the client lost the connection.
    The program has lost connection problem : http://ivebug.tripod.com/new-lost.zip

  • Can  object(instance TreeMap) be inserted in a File by objectoutputstream??

    Can a object containing TreeMap instance be inserted in a File by objectoutputstream??
    class pfore{
    static class TextFile
              String category;
              String filename;
                    TreeMap filewords;
                    TextFile( )
                    {category=filename=null;
                     filewords=new TreeMap();
                    TextFile(String category,String filename,TreeMap filewords)
              this.category=category;
              this.filename=filename;
                   // this.filewords=new TreeMap();
                    this.filewords=new TreeMap(filewords);
    public static void main (String args[]){
    //creating an object of TextFile by reading a text file and also initializing it
    TextFile ob=new TextFile("dd","ff",kp);
    //kp is a created TreeMap object
    *__try{    FileOutputStream fos= new FileOutputStream("serrial.txt");__*
               *__ObjectOutputStream oos=new ObjectOutputStream(fos);__*
                *__oos.writeObject(ob);__*               
                 *__oos.flush();__*
                 *__oos.close();__*
                      *__catch(IOException e) {__*
           *__System.out.println("exception while opening the filestream"+e);__*
           *__e.printStackTrace();__*
           *__System.exit(0);__*
    }//end main
    }//end class
    Please see the underlined part because other parts are completely ok.
    it's giving exceptions like
    at.java.io.objecstreamclass invokewriteObject
    at.java.io.objectoutputstream.writeserialData
    at.java.io.objectoutputstream.writeOrdinaryObject.etc..etc

    suppose a class is a textfile in java..containing a TreeMap instance ,and two string variables as instance..
    class textfile implements Serializable
    String foo;
    String foo1;
    TreeMap t;
    textfile t=new textfile( );now how to write object t in file??
    with objectoutputstream i have tried it..bt it is throwing exceptions..
    the details i have posted in my previous Question(see above-the code)
    please give in details how to do this??

  • How to send multiple objects in a ObjectOutputStream

    1) I need to get more than one text field and send it to the servlet.
    2) How do I keep the Objects seperate in the servlet when they get inputed. I have to so I can sabe them to seperate variables.
    Applet Code
    URL url = new URL("http://www.mysite.com/servlet/Hello");
    URLConnection servletConnection = url.openConnection();
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setUseCaches(false);
    servletConnection.setDefaultUseCaches(false);
    servletConnection.setRequestProperty("Content-Type","application/octet-stream");
    ObjectOutputStream out = new ObjectOutputStream(servletConnection.getOutputStream());
    //Gets data from text field
    out.writeObject( (Object) cusNum.getText() ); //(Object)
    // I need to get more than one text field and send it to the servlet.
    out.flush();
    out.close();Servlet Code
    ObjectInputStream inputFromApplet = new     ObjectInputStream(request.getInputStream());
    String fromApplet = (String) inputFromApplet.readObject();
    inputFromApplet.close();

    //Gets data from text fieldNo, this gets data from text field and writes it to the output.
    out.writeObject( (Object) cusNum.getText() ); //(Object)So that writes one object.
    // I need to get more than one text field and send it to the servlet. So do that.
    String fromApplet = (String) inputFromApplet.readObject();Here you have read one object. If you want to read another, do so.

  • Reset() of ObjectOutputStream diff in Linux and Windows

    From the previous post and my test, it is better to call ObjectOutputStream oos.reset() to clean up buffer.
    But I notice that it works all fine in Linux, but if the remote site is a Windows machine, if you call oos.reset(), the remote site will throw socket.reset Exception and close the socket, which is not good at all.
    So I have to disable oos.reset() call to avoid remote java socket in Windows close, but I get OutOfTheMemory error after running a while, I suspect it is caused by not calling reset() and clean up buffer. So what should I do to avoid this problem?
    Thanks

    It sounds like you are running different versions or a buggy of the JDK.
    What versions are you using?
    This works fine with 1.4.2_05 (between Solaris and Windows)

  • ObjectOutputStream: Sending the same but modified Object twice

    Using the Windows JRE1.6_05 or the JRE 1.6 on Mac OS X and the following code for the client:
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.net.Socket;
    public class Client {
         public static void main(String[] args) throws Exception {
              Socket s=new Socket("127.0.0.1",5000);
              ObjectOutputStream oos= new ObjectOutputStream(s.getOutputStream());
              StringBuffer sb=new StringBuffer("foo");
              oos.writeObject(sb);
              sb.replace(0, sb.length(), "bar");
              oos.writeObject(sb);
    }and the following code for the server
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class Server {
         public static void main(String[] args) throws Exception {
              ServerSocket ss=new ServerSocket(5000);
              Socket s= ss.accept();
              ObjectInputStream ois= new ObjectInputStream(s.getInputStream());
              StringBuffer sb=(StringBuffer)ois.readObject();
              System.out.print(sb);
              sb=(StringBuffer)ois.readObject();
              System.out.println(" "+sb);
    }I expect to get the output "foo bar" but getting "foo foo". For every object type it is true that the non-modified object is received, if the same but modified object is sent twice. Is this a bug?

    burghard.britzke wrote:
    The substitution of writeObject(obj) with writeUnshared(obj) on the client and readObject(obj) with readUnshared(obj) lead to the "foo foo", too.I always use reset() on the OOS.
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(baos);
                StringBuffer sb = new StringBuffer("foo");
                oos.reset();
                oos.writeObject(sb);
                sb.replace(0, sb.length(), "bar");
                oos.reset();
                oos.writeObject(sb);
                oos.close();
                ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
                StringBuffer sb = (StringBuffer) ois.readObject();
                System.out.print(sb);
                sb = (StringBuffer) ois.readObject();
                System.out.println(" " + sb);
            }

  • How does ObjectOutputStream work?

    just have a question about how ObjectOutputStream works.
    Does it buffer? If I write out a value, let's say an int using out.writeInt(value), does it write it out immediately to the stream or buffer it? I want to use a BufferedOutputStream, but if it already buffers than the BufferedOutputStream won't make that much of a difference.
    thanks

    Seems like it would be very easy to test this and fiind out if it helps.

  • StreamCorruptedException when using ObjectOutputStream

    Hello.
    I'm writing a client-server program that is like a chat, in which client connect to the server and communicate. At the moment, I'm just trying to pass messages from the client to the server, vice-versa.
    I manage to do so, but after the first message something gets wrong and I get a StreamCorruptedException.
    I will show you the code, hoping it is not too long...
    The client
    /****************** CLIENT ********************/
    public class ClientChat extends javax.swing.JFrame implements Runnable, Serializable
        String UserName,ServerName;      
        int ServerPort,TotalUserCount,G_ILoop;     
        Socket socket;
        ObjectInputStream objectinputstream;
        ObjectOutputStream objectoutputstream;       
        ClientLogin login;
        DefaultListModel model;
        Client client;
        Message  message;
        StringBuffer stringbuffer;
        Thread thread;
        StringTokenizer Tokenizer;
        public ClientChat()
    /**********Getting all the Parameteres***********/     
            UserName = "";
            TotalUserCount = 0;
            model = new DefaultListModel();       
            initComponents();       
            loginToChat();
        private void loginToChat()
         //nevermind what's here - i dropped it just to make the reading easier.
         //what's important is that we get the ServerName and the ServerPort
         //and we initialize the  client
         client = //some code...
         ServerName      = login.jTextFieldServer.getText();
         ServerPort      = Integer.parseInt(login.jTextFieldPort.getText());
         connectToServer();
    private void connectToServer()
         try
              socket = new Socket(ServerName,ServerPort);     
              MessageClient messageClient = new MessageClient("HELLO", client);
              objectoutputstream = new ObjectOutputStream(socket.getOutputStream());
              SendMessageToServer(messageClient);                   
              objectinputstream = new ObjectInputStream(socket.getInputStream());
              thread = new Thread(this);
              thread.start();                
         catch(IOException ex)
         {QuitConnection(2);     }               
        public void run()
            while (thread != null)
                try
                    *message = (Message)objectinputstream.readObject();*
                    String  type = message.getType();
                    if (type.startsWith("LIST"))
               //do something
                   /********** ADD RFC *********/
                    if (type.startsWith("ADD"))  
              //do something
                catch (Exception _Exc)
                {  QuitConnection(0);   }
        /*********Function to Destroy all the Objects********/
    private void QuitConnection(int QuitType)
            if(socket != null)
         try
              MessageUsername messageUserNameQuit = new MessageUsername("QUIT", UserName);
              SendMessageToServer(messageUserNameQuit);
              objectoutputstream.close();
              objectinputstream.close();
              socket.close();     
              socket = null;                    
         catch(IOException _IoExc) {}               
           if(thread != null)
         thread.stop();
         thread = null;
    private void SendMessageToServer(Message message)
                    try
              objectoutputstream.writeObject(message);
         catch(IOException _IoExc)
         { QuitConnection(0);}               
    The sever:
    /****************** SERVER  ********************/
    public class ServerChat extends javax.swing.JFrame implements Runnable,Serializable
        ServerSocket serversocket;
        Socket socket;
        ArrayList userarraylist,messagearraylist;
        Thread thread;
        ChatCommunication chatcommunication;     
        ObjectOutputStream objectoutputstream;
        int G_ILoop;
        ClientObject clientobject;
        public ServerChat()
            initComponents();         
        public void run()
        {   /*********Accepting all the client connections and create a seperate thread******/
            while(thread != null)
         try
              /********Accepting the Server Connections***********/
              socket = serversocket.accept();                    
              /******* Create a Seperate Thread for that each client**************/
              chatcommunication = new ChatCommunication(this,socket);          
              thread.sleep(1500);     
         catch(Exception _INExc)
              ExitServer();     
        /*****     Function To Send a Message to Client     **********/
        private void SendMessageToClient(Socket clientsocket, Message message)
            try
                objectoutputstream = new ObjectOutputStream(clientsocket.getOutputStream());
                objectoutputstream.writeObject(message);
            catch (IOException _IOExc)
                System.out.println("Error while trying to send a message to the client");
        /********Function To Add a New Client in to the Server List**********/
    protected void AddUser(Socket ClientSocket,String UserName)
    /********Send the New User Detail into All Other Users****/                         
         int m_userListSize = userarraylist.size();
         MessageUsername messageUserNameToAdd = new MessageUsername("ADD", UserName);
         //i dropped something not relevant - populating the stringbuffer
         /*****Add a user in to array list***/
         clientobject = new ClientObject(ClientSocket,UserName);
         userarraylist.add(clientobject);
         stringbuffer.append(UserName);
         stringbuffer.append(";");
         MessageUsersList messageListOfUsers = new MessageUsersList("LIST", stringbuffer.toString());
         SendMessageToClient(ClientSocket, messageListOfUsers);          
        private void ExitServer()
         if(thread != null)
              thread.stop();
              thread = null;
         try
                         if(serversocket != null)
                   serversocket.close();
                   serversocket = null;
         catch(IOException _IOExc) { }          
    }And a listener of the server, that gets the messages from the client and passes them to the server
    /******* LISTENER OF THE SERVER  ********************/
    public class ChatCommunication implements Runnable
         Thread thread;
         Socket socket;
                    ObjectInputStream objectinputstream;
         Message recievedMessage;
         ServerChat Parent;
         /*****Initialize the Socket to the Client******/
         ChatCommunication(ServerChat ServerChat,Socket clientsocket)
              Parent = ServerChat;
              socket = clientsocket;     
         try  {     
                objectinputstream = new ObjectInputStream (socket.getInputStream());          
                   catch(IOException _IOExc) { }
         thread = new Thread(this);
         thread.start();     
    /********Implement the Thread Interface*********/
    public void run()
         while(thread != null)
                       try
                   recievedMessage = (Message)objectinputstream.readObject();          
                   if(recievedMessage.getType().startsWith("HELO"))
                                                                 Client client = ((MessageClient)recievedMessage).getData();
                        Parent.AddUser(socket, client.getName());     
                   //some more cases...
                   catch(Exception _Exc)
                   { QuitConnection();}     
        private void QuitConnection()
         thread.stop();
         thread = null;          
         try
              objectinputstream.close();               
                                     socket.close();
         catch(IOException _IOExc)
         socket = null;     
    }The connection of the first client goes fine, until the second client loggs in:
    When the second client loggs in, a StreamCorruptedException occurs in the line:
    message = (Message)objectinputstream.readObject(); (BOLD in the code).
    For the first client, the exception's message is: "invalid type code: 00" and for the second client it is "invalid type code: AC".
    I have read this thread: http://forum.java.sun.com/thread.jspa?threadID=5177084
    but unfortunately couldn't really understand where my problem hides...
    I've tried to use the flush() method but with no success.
    Can anyone please tell me what's wrong there?
    Thanks a lot!
    Edited by: Haji on Jul 11, 2008 8:24 AM

    Alot of your code is... unwieldy, and I'm finding it difficult to follow.
    What I think I see though and this is a problem is that you open ObjectInputStreams for the life of the the socket but that every time you send a message you
    create a new ObjectOutputStream.
    That is a problem. The creation of object streams has some overhead and "stuff" that gets written to the underlying stream. So what would be happening in your
    case is that your input stream is trying to read a socket but instead is hitting the ObjectOutputStream new stuff again and blowing up because it isn't an object.
    Create the Object input and output streams once and only once and use them for the life of the socket.

  • BitSet values lost during ObjectOutputStream operation!

    I am using ObjectInputStream /ObjectOutputStream to read/write a set of objects in a TreeSet to a file. Everything works fine except for one field of BitSet. The values of BitSet are not preserved. Am I doing something wrong or is this not possible?
    If this is not possible is there any other way to do this, i.e. use another method of writing the objects to the file? Thanks for your help.

    I found the problem. For anyone interested, the problem was that I forgot to define the class, where the BitSet data member was, as serializable. As the result I lost the values of the BitSet data when I worte it into a file.

  • BitSet values ObjectOutputStream operation!

    I am using ObjectInputStream /ObjectOutputStream to read/write a set of objects in a TreeSet to a file. Everything works fine except for one field of BitSet. The values of BitSet are not preserved. Am I doing something wrong or is this not possible?
    If this is not possible is there any other way to do this, i.e. use another method of writing the objects to the file? Thanks for your help.

    Yes you can use it that way... maybe you could post your code as there may be another problem. The following code produces the correct result:
      public static void main( String[] args ) throws Exception {
        File f = new File( "c:/bitset" );
        ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream( f ) );
        BitSet set = new BitSet(3);
        set.set(0);
        set.set(2);
        System.out.println( set );
        out.writeObject(set);
        out.close();
        ObjectInputStream in = new ObjectInputStream( new FileInputStream(f) );
        BitSet set2 = (BitSet)in.readObject();
        System.out.println( set2 );
        in.close();
      }

  • Working with ObjectOutputStream

    I am working with the class ObjectOutputStream, but I dont know what the file extension is that I am working which. Can anyone tell me the type of file this output stream creates?

    Create an ObjectOutputStream over a FileOutputStream, the name in the latter can be anything
    FileOutputStream fos = new FileOutputStream ("myfile.any");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    oos.writeObject(obj);
    ...

  • How to write an ObjectOutputStream to URL connection and rx via an applet

    Hi, i am final year Bsc student from portsmouth England struggling to write an object to a servlet response stream.
    applet code:
    URLConnection connection;
    ObjectInputStream in = null;
    DataCarrier today = null;
    try{
    //connect to url
         URL url = new URL("http://localhost:8080/myapp/getObjectives");
         connection = url.openConnection();
         connection.setDoInput(true);
    // create in object to read from connection response
    /* using print statements i can confirm that this line is not completing */
    ObjectInputStream ois = new ObjectInputStream(connection.getInputStream());
    //print line here does not print
    //type cast incoming object
    today = (DataCarrier)ois.readObject();
         ois.close();     
    catch (Exception e) { }
    Servlet Code:
    //declare DataCarrier class variables
    DataCarrier test;
    test = new DataCarrier();
    test.x = 100;
    test.s = "hello";
    //create output stream from response output stream
    ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(resp.getOutputStream()));
    //write object
    oos.writeObject(test);
         oos.flush();
         oos.close();
    the code compiles and runs ok, with the only error being a nullpointer exception when trying to type cast response object in applet.
    This is because the ObjectInputStream isnt being created.
    I have spent the last week seeking help from lecturers trying to solve this problem with no success what so ever.
    So if any one can offer any advise or comments they will be welcomed with open arms.
    Many thanks in advance.
    dthom

    Do you still need help with this?

  • Multiple ObjectOutputStreams to one ObjectInputStream

    I would like to have multiple ObjectOutputStreams (liviing in their own java apps) creating objects and having them all funnel into the server app, and have a single ObjectInputStream handle all the deserialization. Speed and performance are they key, so don't want a lot of instances of ObjectInputStream around (one for each client) and don't want to have to instantiate one with every received message.
    So, I made my own ByteInputStream that the ObjectInputStream uses that you can pass arrays of bytes to. It manages them and returns bytes to the OOS as needed.
    If I have a single ObjectOutputStream making objects, this works fine. If I have multiple ObjectOutputStreams all making identical objects, it also works. However, if one of the streams gets an object of a different type, it doesn't like it.
    I did some bit checking, and objects from different streams only differ in random bytes throughout the byte array. For example, an object that serializes into a byte stream 500 bytes long, differs in 5 bytes scattered throughout the array - none at the beginning (first 50 bytes)
    Anyone ever try to use multiple OOSs feeding a single OIS? Any ideas on why I see it work if the object are the same, but not if they differ?

    I have created an application which can send/receive 3000 objects per second each in their own ObjectOutputStream/ObjectInputStream
    How many object do you need to send? How much bandwidth do you have? You might find the network is your bottleneck not the number of streams.

  • Appending a file using ObjectOutputStream

    Hi Guys,
    I want to append an object 'x' to an existing file which already has n number of 'x' objects. i tried it this way
    FileOutputStream fileOutputStream = new FileOutputStream("olympics.dat",true);
    ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
    this actually appends to the file but even the signature of the object is added again. this creates a problem while i am trying to read the file.
    i want to know if there is any way to append an object without the signature tagging along.
    Thanks
    Mamatha

    ObjectOutputStream is intended for outputing Objects in a way where they can be reconstructed back to an Object at a later date, i.e. Serialization/Deserialization, the "header" as you call it is needed to achieve this.
    Depending upon your requirements, you could either overide toString() in your object, to allow output of an appropriate string representation of your objects structure to a file, or if you actually wish to just serialize/deserialize the objects to and from file, you could look at writing a class which you pass an object to, which stores the object in a Vector or similar, and which finally uses ObjectOutputStream to write the collection to a file each time it is modified (i.e when a new Object is added to the Vector).
    When you need to retrieve the data, you use an ObjectInputStream to deserialize the Vector, and you can then extract the relevant object from the Vector. You could replace the Vector with a map if you wanted a more efficient way to lookup an individual Object.
    Hope this helps, I've used a similar mechanism to that described above in several applications and it worked fine.

  • StringBuffer and ObjectOutputStream

    I have a question concerning writting a StringBuffer object to a file using ObjectOutputStream (The code snippet is below..). I am merging 2 files together(relatively small files 300 lines). I am storing the merge portion of the 2 files in a StringBuffer. After the merge is done I write this StringBuffer to a file. See code below...
    private void writeToFile()
    try
    ObjectOutputStream outFile = new ObjectOutputStream(new FileOutputStream("Merged.csv"));
    outFile.writeObject(outBuffer.toString()); //outBuffer is a class member
    outFile.flush();
    catch(Exception e)
    e.printStackTrace();
    }//catch
    }//writeToFile
    PROBLEM:
    A snippet of the orginal file that I am reading in:
    Name,GUID,Initial Date,Initial Time,Initial Audit,Last....
    The same line of the merged file that I am writting out:
    ��2openboxs|6openboxes| 'Name,GUID,Initial Date,Initial Time,Initial...
    It is writing out what appears to be junk at the beginning of the file. I did not do any merge at this point. When I print this first line out to the console the junk does not show up?
    If anybody has run in this problem or know what is causing this, then your input would be greatly appreciated.
    Thanks.

    ObjectOuputStream writes a serialized Object to a file. The 'junk' you are seeing is information about the type of object and other things necessary to deserialize the object. You should try reading the API documentation for a class before you start using it. Use the right tool for the job.

Maybe you are looking for