Created
January 9, 2014 10:50
-
-
Save Ribesg/8332391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java 6 | |
SomeStream stream | |
try { | |
stream = new SomeStream(someArg); | |
// Stuff | |
} catch (SomeStreamExceptions e) { | |
// Stuff | |
} final { | |
try { | |
stream.close(); | |
} catch (SomeFailedToCloseException ignored) {} | |
} | |
// Java 7 | |
try (SomeStream stream = new SomeStream(someArg)) { | |
// Stuff | |
} catch (SomeStreamExceptions e) { | |
// Stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment