Results 1 to 4 of 4

Thread: Deserialization

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved Deserialization

    Any ideas on how i could go about deserializing SerObj?
    Code:
      import java.io.*; 
     
      class SerObj implements Serializable{
        transient private int temp; 
        private boolean indicator; 
         
        public SerObj(int temp, boolean indicator){
         this.temp = temp; 
         this.indicator = indicator;
        }
        public int getTemp(){
            return temp; 
        } 
        public boolean getIndicator(){
          return indicator; 
        }
      }
    
     public class X{
      public static void main(String[] args){
      ObjectOutputStream oup = null;   
      try{
        oup = new ObjectOutputStream(new FileOutputStream("C:" + File.separator + "ObjSerFile")); 
         oup.writeObject(new SerObj(68,true));   
       }catch(IOException io){
           System.err.println(io); 
       }finally{
        try{
         oup.close(); 
         }catch(IOException io){
           System.err.println(io);     
        }
       }
      }
     }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width