Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

use .writeObject but without using FileOutputStream  RSS feed

 
Amit Dubey Kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to use .writeObject but without using FileOutputStream
actuly i dont want to make newfile i want to get direct arraylist object
please tell me if anybody know about this my code servlet is
try
{

FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(aa);
System.out.println("writeobject" +oos);
oos.close();
FileInputStream fis=new FileInputStream("t.tmp");
ObjectInputStream resultStream = new ObjectInputStream(fis);
ArrayList as=(ArrayList)resultStream.readObject();
System.out.println("Array"+ as);

and my java code is


URL servlet = new URL("http://localhost:8080/Test1/Testservlet");

System.out.println("amit" +servlet);
URLConnection conn=servlet.openConnection();
conn.setDoOutput(true);
InputStreamReader isr=new InputStreamReader(conn.getInputStream());

FileInputStream fis=new FileInputStream("C:/Program Files/Apache Software Foundation/Tomcat 5.0/bin/t.tmp");
ObjectInputStream resultStream = new ObjectInputStream(fis);
ArrayList as=(ArrayList)resultStream.readObject();
System.out.println("Arrayforjava"+ as);


HttpMethod method = new GetMethod();


but here i m using one extra tmp file now i dont want to use that file so any body tell me what i have to do for That

please


a very very thanks in advance
[ October 28, 2007: Message edited by: Amit Dubey Kumar ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'll need to tell us a little more about what you're doing.
Is this part of a servlet app?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit Dubey Kumar:
i want to use .writeObject but without using FileOutputStream
actuly i dont want to make newfile i want to get direct arraylist object
please tell me if anybody know about this


a very very thanks in advance


It is not very clear what you are trying to do. Please elaborate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!