GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update core-java-modules/core-java-io-5/src/test/java/com/baeldung/ou… · edizor/tutorials@e1f7270

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • core-java-modules/core-java-io-5/src/test/java/com/baeldung/outputstreamtobytearray
    • OutputStreamToByteArrayUnitTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎core-java-modules/core-java-io-5/src/test/java/com/baeldung/outputstreamtobytearray/OutputStreamToByteArrayUnitTest.java‎

Copy file name to clipboardExpand all lines: core-java-modules/core-java-io-5/src/test/java/com/baeldung/outputstreamtobytearray/OutputStreamToByteArrayUnitTest.java
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ public void givenFileOutputStream_whenUsingDrainableOutputStream_thenReturnByteA
3535
Path filePath = tempDir.resolve(fileName);
3636

3737
DrainableOutputStream drainableOutputStream = new DrainableOutputStream(new FileOutputStream(filePath.toFile()));
38-
39-
try {
38+
try (drainableOutputStream) {
4039
drainableOutputStream.write(data.getBytes(StandardCharsets.UTF_8));
41-
} finally {
42-
drainableOutputStream.close();
4340
}
4441

4542
byte[] writtenData = drainableOutputStream.toByteArray();

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.