Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Need some help porting from C#

Reply
Thread Tools

Re: Need some help porting from C#

 
 
Andy
Guest
Posts: n/a
 
      01-16-2008
On Jan 16, 2:38 pm, Andy <(E-Mail Removed)> wrote:
> HI,
>
> I'm trying to port some code from C# to Java. The C# code uses a <a
> href="http://msdn2.microsoft.com/en-us/library/
> system.runtime.serialization.formatters.binary.bin aryformatter(VS.
> 85).aspx">BinaryFormatter</a> class to serialize the object or graph
> to a binary representation. What would be the class equivalent in
> Java?
>
> Thanks
> Andy


Opps... google didn't like my html.. the C# class is BinaryFormatter.
Documentation can be found here:
http://msdn2.microsoft.com/en-us/lib...er(VS.85).aspx
 
Reply With Quote
 
 
 
 
rossum
Guest
Posts: n/a
 
      01-16-2008
On Wed, 16 Jan 2008 11:39:31 -0800 (PST), Andy <(E-Mail Removed)>
wrote:

>On Jan 16, 2:38 pm, Andy <(E-Mail Removed)> wrote:
>> HI,
>>
>> I'm trying to port some code from C# to Java. The C# code uses a <a
>> href="http://msdn2.microsoft.com/en-us/library/
>> system.runtime.serialization.formatters.binary.bin aryformatter(VS.
>> 85).aspx">BinaryFormatter</a> class to serialize the object or graph
>> to a binary representation. What would be the class equivalent in
>> Java?
>>
>> Thanks
>> Andy

>
>Opps... google didn't like my html.. the C# class is BinaryFormatter.
>Documentation can be found here:
>http://msdn2.microsoft.com/en-us/lib...er(VS.85).aspx


Reading the MS documentation: "Serializes and deserializes an object,
or an entire graph of connected objects, in binary format."

This looks a lot like Java Serialization:
http://java.sun.com/developer/techni...serialization/

rossum

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      01-17-2008
Andy wrote:
>> Documentation can be found here:
>> http://msdn2.microsoft.com/en-us/lib...er(VS.85).aspx


rossum wrote:
> Reading the MS documentation: "Serializes and deserializes an object,
> or an entire graph of connected objects, in binary format."
>
> This looks a lot like Java Serialization:
> http://java.sun.com/developer/techni...serialization/


<http://java.sun.com/javase/6/docs/api/java/io/Serializable.html>

--
Lew
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      01-25-2008
On Jan 16, 3:27*pm, rossum <(E-Mail Removed)> wrote:
> On Wed, 16 Jan 2008 11:39:31 -0800 (PST), Andy <(E-Mail Removed)>
> wrote:
>
>
>
>
>
> >On Jan 16, 2:38 pm, Andy <(E-Mail Removed)> wrote:
> >> HI,

>
> >> I'm trying to port some code from C# to Java. *The C# code uses a <a
> >> href="http://msdn2.microsoft.com/en-us/library/
> >> system.runtime.serialization.formatters.binary.bin aryformatter(VS.
> >> 85).aspx">BinaryFormatter</a> class to serialize the object or graph
> >> to a binary representation. *What would be the class equivalent in
> >> Java?

>
> >> Thanks
> >> Andy

>
> >Opps... google didn't like my html.. the C# class is BinaryFormatter.
> >Documentation can be found here:
> >http://msdn2.microsoft.com/en-us/lib....serialization...

>
> Reading the MS documentation: "Serializes and deserializes an object,
> or an entire graph of connected objects, in binary format."
>
> This looks a lot like Java Serialization:http://java.sun.com/developer/techni...ming/serializa...
>
> rossum- Hide quoted text -
>
> - Show quoted text -


Ok, so simply implementing the interface is fine.. no code needs to be
written, Java will handle finding the fields and restoring them?

Sounds great, thanks!
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      01-25-2008
Andy wrote:
> Ok, so simply implementing the [java.io.Serializable] interface is fine.. no code needs to be
> written, Java will handle finding the fields and restoring them?


Not true. Implementing Serializable naively will appear to work, at first,
but can cause major performance hits and kill future maintainability.

Read the chapters in Joshua Bloch's seminal book, /Effective Java/, that
pertain to serialization. There are a host of pitfalls, and likely some
methods and members that you will need to write, that is, if you want your
code to go into production. And survive there.

--
Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help porting Perl function kj Python 10 06-08-2008 04:52 PM
Problem with porting some STL code from VS to GCC Frank Steinmetzger C++ 2 03-29-2008 09:10 PM
Need help porting a C++ / Python Embedded app to multiple platforms jpw Python 1 02-05-2008 11:35 PM
Need some help porting from C# Andy Java 2 01-17-2008 01:18 AM
Need some help for some perl homework.... Perl 0 02-25-2004 01:45 AM



Advertisments