How to close a PST file in Java? -
i using java-libpst.0.7.jar reading pst messages. using following code open pst file read messages.
pstfile pstfile = new pstfile("path of pst file");
i have close pst file once after getting message details. there no option close pst file. how can this?
by reading code, it's apparent libpst indeed not expose "close" method. finalize()
method close underlying file when pstfile
garbage-collected, i'd recommend use in smallest scope possible , dispose of asap, other there's not can (except reporting issue project - or better yet, sending patch yourself, of course).
edit 1:
pstfile
has getfilehandle()
method returns underlying file, close()
that:
pstfile pstfile = new pstfile("path of pst file"); // use file pstfile.getfilehandle().close();
edit 2:
i've created pull request add pstfile.close()
. let's see how fans out.
edit 3:
pull request has been merged (thanks richard johnson!). in next release (or if build java-libpst yourself) you'll able call close()
on pstfile
directly.
Comments
Post a Comment