Review for 7157656 (zipfs) SeekableByteChannel to entry in zip file...

Alan Bateman Alan.Bateman at oracle.com
Tue Apr 17 10:51:27 UTC 2012


"On 17/04/2012 11:28, Paul Sandoz wrote:
> :
>
>> One thing I notice, and nothing to do with your patch, is that the position(long) method is missing an implementation, it shouldn't throw UOE.
> There is a comment:
> // sbc.position(pos) is not supported in current version
> in the test code. I put test checks in place, mainly to be consistent, rather than any foresight on my part.
position(long) needs an implementation, except when the file is opened 
for append.

The append case is special, from the javadoc:

"Setting the channel's position is not recommended when connected to an 
entity, typically a file, that is opened with the |APPEND| 
<http://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardOpenOption.html#APPEND> 
option. When opened for append, the position is first advanced to the 
end before writing."

truncate(long) also includes a warning:

" An implementation of this interface may prohibit truncation when 
connected to an entity, typically a file, opened with the |APPEND| 
<http://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardOpenOption.html#APPEND> 
option."

Unfortunately we don't clearly specify what "prohibit truncation" means 
(in terms of exceptions, but an IOException is appropriate).

-Alan.



More information about the core-libs-dev mailing list