Article View: borland.public.jbuilder.java.api
Article #2304Re: Serializing Objects
From: David Chase
Date: Wed, 28 Mar 2001 03:54
Date: Wed, 28 Mar 2001 03:54
22 lines
2069 bytes
2069 bytes
"Harry J. Kobetitsch" wrote:
> in the case of implementing Serializable and adding the two
> private methods writeObject and readObject.
> Can anyone explain how ObjectOutputStream and
> ObjectInputStream objects have access to private methods
> writeObject and readObject?
Reflection calls. If the security manager allows it,
you can invoke the instance method
java.lang.reflect.AccessibleObject.setAccessible()
(j.l.r.AO is the parent type of Field and Method)
and then protection does not apply to accesses through
that particular instance of Field or Method.
Native calls can also do this, without consulting
any pesky security manager.
David Chase
david.chase@naturalbridge.com
Technical Details
Message-ID:
<3AC1605A.A4FFE03@world.std.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsxfer.eecs.umich.edu!nntp.msen.com!uunet!ash.uu.net!world!newsReferences:
<99rkt0$q6$1@slb2.atl.mindspring.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,67882b654b2a8c13 X-Google-Attributes: gid1089d0,public X-Google-Thread: 10a146,67882b654b2a8c13 X-Google-Attributes: gid10a146,public X-Google-Thread: f74b3,67882b654b2a8c13 X-Google-Attributes: gidf74b3,public X-Google-Thread: 10bb9b,67882b654b2a8c13 X-Google-Attributes: gid10bb9b,public X-Google-Thread: 113ae9,67882b654b2a8c13 X-Google-Attributes: gid113ae9,public X-Google-ArrivalTime: 2001-03-27 19:58:03 PST Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.java.language,comp.lang.java.help,comp.lang.java.machine,comp.lang.java.programmer Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsxfer.eecs.umich.edu!nntp.msen.com!uunet!ash.uu.net!world!news From: David Chase <chase@world.std.com> Subject: Re: Serializing Objects Sender: news@world.std.com (Mr Usenet Himself) Message-ID: <3AC1605A.A4FFE03@world.std.com> Date: Wed, 28 Mar 2001 03:54:02 GMT Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii References: <99rkt0$q6$1@slb2.atl.mindspring.net> NNTP-Posting-Host: world-f.std.com Mime-Version: 1.0 X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) Organization: The World @ Software Tool & Die Lines: 22