You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "steven-aerts (via GitHub)" <gi...@apache.org> on 2023/05/08 08:31:23 UTC

[GitHub] [avro] steven-aerts commented on a diff in pull request #2203: AVRO-3748 [java] fix SeekableInputStream.skip

steven-aerts commented on code in PR #2203:
URL: https://github.com/apache/avro/pull/2203#discussion_r1187178181


##########
lang/java/avro/src/test/java/org/apache/avro/file/TestSeekableInputStream.java:
##########
@@ -0,0 +1,28 @@
+package org.apache.avro.file;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Path;
+
+public class TestSeekableInputStream {
+    @Test
+    public void testSkip(@TempDir Path tempDir) throws IOException {
+        File f = tempDir.resolve("testSkip.avro").toFile();
+        try (FileWriter w = new FileWriter(f)) {
+            w.write("someContent");
+        }
+        try(DataFileReader.SeekableInputStream stream =
+                    new DataFileReader.SeekableInputStream(new SeekableFileInput(f))

Review Comment:
   Done



##########
lang/java/avro/src/test/java/org/apache/avro/file/TestSeekableInputStream.java:
##########
@@ -0,0 +1,28 @@
+package org.apache.avro.file;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Path;
+
+public class TestSeekableInputStream {
+    @Test
+    public void testSkip(@TempDir Path tempDir) throws IOException {
+        File f = tempDir.resolve("testSkip.avro").toFile();
+        try (FileWriter w = new FileWriter(f)) {
+            w.write("someContent");
+        }
+        try(DataFileReader.SeekableInputStream stream =
+                    new DataFileReader.SeekableInputStream(new SeekableFileInput(f))
+        ) {
+            for (int i = 0; i < stream.length(); i++) {

Review Comment:
   Done



-- 
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: issues-unsubscribe@avro.apache.org

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