You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/04/27 07:42:46 UTC

[GitHub] [lucene] jpountz commented on a change in pull request #107: LUCENE-9047: Move the Directory APIs to be little endian (take 2)

jpountz commented on a change in pull request #107:
URL: https://github.com/apache/lucene/pull/107#discussion_r620941684



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java
##########
@@ -640,6 +640,33 @@ static void writeCRC(IndexOutput output) throws IOException {
       throw new IllegalStateException(
           "Illegal CRC-32 checksum: " + value + " (resource=" + output + ")");
     }
-    output.writeLong(value);
+    writeLong(output, value);
+  }
+
+  /** write int value on header / footer */
+  public static void writeInt(DataOutput out, int i) throws IOException {

Review comment:
       Maybe say explicitly on these methods that they write in big-endian order?

##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/store/DirectoryUtil.java
##########
@@ -0,0 +1,56 @@
+package org.apache.lucene.backward_codecs.store;
+
+import java.io.IOException;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Utility class to wrap open files
+ *
+ * @lucene.internal
+ */
+public final class DirectoryUtil {

Review comment:
       Give it a more descriptive name, e.g. `EndiannessReverserUtil` or something along these lines for consistency with the input/output wrapper names?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org