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

how to serialize String[ ][ ]

 
David George
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a project which need to serialize a String[][] from Server to Client.How should i deal with it?I tried to put all the String[] in an ArrayList.But i can not turn the ArrayList to String[][].What should i do?
Thank you for your help.
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would give you some warnings By you question your are probably planing to make all the business logic in your client side but think about when you will use the networked environment... what happens when your client get disconnected from server ?

Client call:
1- lock
2- update
-- get disconnected

that wouldn't be easy to handle with. So I made an OO framework that contains all the business logic (book, unbook and search) and my remote object provides this funcionality.
 
Thomas Paul Bigbee
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could put your String[][] into a Serializable Object and do the below

Note 1.5 Generics used, remove all <xxx> if using 1.4.2, etc...



It worked for me, hope this helps
Tom
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11833
181
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sheng,

Originally posted by sheng peng:
I wrote a project which need to serialize a String[][] from Server to Client.How should i deal with it?I tried to put all the String[] in an ArrayList.But i can not turn the ArrayList to String[][].What should i do?
Thank you for your help.


Why can't you turn the ArrayList into a String[][]? What have you tried? Not knowing what you have done / not done makes it very hard to offer suggestions that you can learn by (rather than just presenting solutions which is not a very good way for you to learn).

But to give you another solution, converting the ArrayList to a String[][]:The for loop which I created to show that it did convert the data for me is a bit faulty, but it is there just to demonstrate the two lines that are the actual conversion, so I am not worried about them.

Regards, Andrew
[ August 23, 2005: Message edited by: Andrew Monkhouse ]
 
David George
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much,friends.I think i will pass the SCJD examination with the help of you.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic