From c239150b538d372281d59bfffb211c8a0bbf3b10 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 19 Nov 2025 21:08:01 -0800 Subject: [PATCH] fix buffer --- .../seaweedfs/client/SeaweedStreamIntegrationTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/other/java/client/src/test/java/seaweedfs/client/SeaweedStreamIntegrationTest.java b/other/java/client/src/test/java/seaweedfs/client/SeaweedStreamIntegrationTest.java index a07c03c84..f384e059f 100644 --- a/other/java/client/src/test/java/seaweedfs/client/SeaweedStreamIntegrationTest.java +++ b/other/java/client/src/test/java/seaweedfs/client/SeaweedStreamIntegrationTest.java @@ -128,10 +128,15 @@ public class SeaweedStreamIntegrationTest { assertNotNull("Entry should not be null", entry); SeaweedInputStream inputStream = new SeaweedInputStream(filerClient, testPath, entry); + + // Read file in chunks to handle large files properly byte[] readData = new byte[fileSize]; int totalRead = 0; int bytesRead; - while ((bytesRead = inputStream.read(readData, totalRead, fileSize - totalRead)) > 0) { + byte[] buffer = new byte[8192]; // Read in 8KB chunks + + while ((bytesRead = inputStream.read(buffer)) > 0) { + System.arraycopy(buffer, 0, readData, totalRead, bytesRead); totalRead += bytesRead; } inputStream.close();