We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8e65de4 + f105c73 commit ee76b7cCopy full SHA for ee76b7c
src/main/java/org/scijava/text/DefaultTextService.java
@@ -63,16 +63,12 @@ public final class DefaultTextService extends
63
@Override
64
public String open(final File file) throws IOException {
65
// This routine is from: http://stackoverflow.com/a/326440
66
- final FileInputStream stream = new FileInputStream(file);
67
- try {
+ try (final FileInputStream stream = new FileInputStream(file)) {
68
final FileChannel fc = stream.getChannel();
69
final MappedByteBuffer bb =
70
fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
71
return Charset.defaultCharset().decode(bb).toString();
72
}
73
- finally {
74
- stream.close();
75
- }
76
77
78
0 commit comments