java - buffered reader in managed bean -
in web app, beans have serializable. i'm wanting open couple of streams, input , output device, in @postconstruct , leave them open. however, streams aren't serializable. so, if bean serialized, happens streams? if make them transient, have restore them when bean deserialized? if so, simple checking stream null , reopening them if null? or, better open , close them every time read or write?
probably better approach customise serialisation, i.e. in writeobject
flush buffers/close streams/write additional state/etc, in readobject
restore original object state.
Comments
Post a Comment