Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/main/java/org/scijava/text/DefaultTextService.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,12 @@ public final class DefaultTextService extends
@Override
public String open(final File file) throws IOException {
// This routine is from: http://stackoverflow.com/a/326440
final FileInputStream stream = new FileInputStream(file);
try {
try (final FileInputStream stream = new FileInputStream(file)) {
final FileChannel fc = stream.getChannel();
final MappedByteBuffer bb =
fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
return Charset.defaultCharset().decode(bb).toString();
}
finally {
stream.close();
}
}

@Override
Expand Down