kvr000 commented on code in PR #455:
URL: https://github.com/apache/commons-compress/pull/455#discussion_r1439173423


##########
src/main/java/org/apache/commons/compress/archivers/zip/RandomAccessOutputStream.java:
##########
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.commons.compress.archivers.zip;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+/**
+ * Abstraction over OutputStream which also allows random access writes.
+ */
+abstract class RandomAccessOutputStream extends OutputStream {

Review Comment:
   The purpose is to provide append only `OutputStream` with possibility to 
write to arbitrary position.  The `pread/pwrite` semantics is much more 
meaningful than `seek/tell` semantics in this case as the caller should not be 
able to change actual position of `OutputStream` stream.  Apart from following 
the callers usage, this scales much better in concurrent environment (not 
necessarily the case here, more useful in `ZipFile` reader which already uses 
this approach).
   
   I'm not sure I fully followed the second part.  The meaning of `write()` - 
full or partial - should be defined in interface, and the implementations 
should behave consistently with the interface.  I used `writeFully` name to 
avoid conflict with `FileChannel.write` which declares that it may be only 
partial write and such naming is also consistent with other 3rd-parties 
libraries.  I agree the `At` can be removed from `writeFullyAt`, though in my 
opinion it's often better to be explicit with naming rather than relying on 
different method signature.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to