[
https://issues.apache.org/jira/browse/IO-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18060939#comment-18060939
]
Makarand Hinge commented on IO-883:
-----------------------------------
[~ggregory] [~kwin]
I wonder if instead of introducing a new SeekableReadOnlyByteChannel interface,
it might be simpler to support an optional read-only mode in
ByteArraySeekableByteChannel itself. For example, a boolean flag or factory
method could enforce read-only behavior and throw NonWritableChannelException
from both write() and truncate().
This would mirror how file channels behave and ensure the restriction is
enforced at runtime rather than only at the type level.
> ByteArraySeekableByteChannel should optionally expose a read-only channel
> -------------------------------------------------------------------------
>
> Key: IO-883
> URL: https://issues.apache.org/jira/browse/IO-883
> Project: Commons IO
> Issue Type: Improvement
> Affects Versions: 2.21.0
> Reporter: Konrad Windszus
> Priority: Major
> Attachments: SeekableReadOnlyByteChannel.patch
>
>
> In certain cases there should be no writes being performed through the
> SeekableByteChannel. Similar as for files it should be possible to wrap it as
> read-only and throw {{NonWritableChannelException}} for all operations trying
> to write to the wrapped array.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)