• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

serialization

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does serialization mean?

may i sent any java object over hyper text transfer protocal request and recieve the same at server.

if there is any other way please any one tell me the things. I got to perform for same.

thanks in advance.
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Serialization means breaking up an object into a Series (usually of bytes). Note that you usually leave any static members and anything marked "transient" behind. You can save the bytes in a file, or send them across a network. Don't know whether that means sending an object across the internet, but I don't see why not.
Go here, download and unzip a copy of Thinking In Java (Bruce Eckel, 3rd edition) and look at the second part of the chapter about interfaces and inner classes (I think ch 8). (There is a 4th edition, but you have to pay for that! I've got it and just looking at the chapter for about 30 seconds, I don't think that much has changed.)
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vijay shanker:
What does serialization mean?



Serialization is a process in which you can "serialize" or "persist" the state of an object in a permanent storage.

What are these terms mean?

persist means saving.
permanent means into a file in a disk for example.
state of an object means the data values an instance holds to get its uniqueness.

Why do you need such an action?

When you say "a state of an object", the scope of the state is existing only temporarily. that means till the time your program is in memory (memory which helps you create an object]. What if you need to hold the data values held by an object even after the program terminates?

You need to shift the data values from this memory (RAM) to another place, that could range anything which helps to get the values without the actual program which was responsible of dealing with this particular instance.

That target location should offer you the "permanent" storage. That's why this persistence came in picture and you have "serialization" to achieve this.

To read more about Serialization, you may please read the Sun's tutorials here.

Does that help?
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vijay shanker:


may i sent any java object over hyper text transfer protocal request and recieve the same at server.



Do you mean to ask the provision to send an object's state in a web application? Is that way you meant by HTTP in your question?
 
vijay shanker
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Mr. Raghavan Muthu,

This is what i suppose to do.

Actually i am asked to send some database records from client to server and then i got to think of this.

What do you see about that?

Thanks;
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vijay shanker:


....Actually i am asked to send some database records from client to server and then i got to think of this.



Yes, thats correct. You need to prepare an object out of the database records and you can send the object to a method in the server.

You do NOT need to take care of anything except making the object you send as a 'serializable' one.
 
vijay shanker
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What i am doing is making an file useing ObjectOutputStream and sending that file

but at other side i mean at server side i am not able to make object using 'readObject()' method from the file i get there.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you serialize with a ByteArrayOutputStream and get a byte[] array and then catch it at the other end with a ByteArrayInputStream? I don't know much about that; I have never tried myself.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you need any of those Stream objects. Just make an object in the client side as "serializable" (means, make the class implements the Serializable interface) and send that object of the class as an argument to the method in the Server.

You need to make a RMI call here.
 
vijay shanker
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If that is the case i got to ask you how to do that call over Http is it possible to make RMI call over Http?
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What sort of a UI do you have? Is it a jsp rendered HTML?
If yes, then you are just wasting your time thinking about serialization.
There is no way you can use Serialization untill and unless you are really prepared to write some jazzy looking code.
[ January 02, 2008: Message edited by: Nitesh Kant ]
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic