You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2017/02/17 13:23:59 UTC
[Bug 60741] New: NPOIFS move from read-only flag to 3-state enum
https://bz.apache.org/bugzilla/show_bug.cgi?id=60741
Bug ID: 60741
Summary: NPOIFS move from read-only flag to 3-state enum
Product: POI
Version: 3.16-dev
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P2
Component: POIFS
Assignee: dev@poi.apache.org
Reporter: apache@gagravarr.org
Target Milestone: ---
Currently, in NPOIFS (NPOIFSFileSystem + POIFSFileSystem, but not
OPOIFSFileSystem), you can either load from a File or from a Stream. With a
Stream, everything gets buffered into memory
When loading from a File, you can load read-write or read-only. In
read-write mode, we use NIO to mmap the file so we can quickly + low memory
read + write.
The other case, File + read-only, isn't so ideal. We need to support both
people doing true read-only cases, eg reading or text extraction, plus
people doing read-template + write or read-change-save-as cases. To support
that, we buffer into memory.
Instead, if we changed the read-write state to an enum with 3 states, we could
have:
* Read/Write - unchanged
* Read Only - mmap in read-only mode, text extraction etc only
* Read as Template - mmap in private mode, changes buffered in memory, able to
write out to a new file
That'd mean lower memory use, and more consistent code.
Naming TBC
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 60741] NPOIFS move from read-only flag to 3-state enum
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60741
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Help needed with naming the enum and the enum values...
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
RE: [Bug 60741] NPOIFS move from read-only flag to 3-state enum
Posted by "Murphy, Mark" <mu...@metalexmfg.com>.
+1
-----Original Message-----
From: bugzilla@apache.org [mailto:bugzilla@apache.org]
Sent: Friday, February 17, 2017 12:43 PM
To: dev@poi.apache.org
Subject: [Bug 60741] NPOIFS move from read-only flag to 3-state enum
https://bz.apache.org/bugzilla/show_bug.cgi?id=60741
--- Comment #2 from Greg Woolsey <gw...@apache.org> --- (In reply to Nick Burch from comment #1)
> Help needed with naming the enum and the enum values...
Perhaps
public enum WriteState {
READ_ONLY,
IN_PLACE,
BUFFERED,
;
}
with appropriate JavaDocs indicating restrictions, performance implications, and example use cases. The Enum and API method JavaDocs would note that this only applies to paths that read from files, not streams.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 60741] NPOIFS move from read-only flag to 3-state enum
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60741
--- Comment #2 from Greg Woolsey <gw...@apache.org> ---
(In reply to Nick Burch from comment #1)
> Help needed with naming the enum and the enum values...
Perhaps
public enum WriteState {
READ_ONLY,
IN_PLACE,
BUFFERED,
;
}
with appropriate JavaDocs indicating restrictions, performance implications,
and example use cases. The Enum and API method JavaDocs would note that this
only applies to paths that read from files, not streams.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 60741] NPOIFS move from read-only flag to 3-state enum
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60741
--- Comment #3 from Andreas Beeker <ki...@apache.org> ---
why invent something new, when there's already an enum [1]?
I'm not saying, to exactly use FileChannel.MapMode, but something look-a-like.
I think the term "read_write" is more intuitive - not so sure about "private"
... but "buffered" could be also associated with something else.
[1]
https://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.MapMode.html
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org