MCPcopy
hub / github.com/google/guava / mapInternal

Method mapInternal

guava/src/com/google/common/io/Files.java:695–711  ·  view source on GitHub ↗
(File file, MapMode mode, long size)

Source from the content-addressed store, hash-verified

693 }
694
695 private static MappedByteBuffer mapInternal(File file, MapMode mode, long size)
696 throws IOException {
697 checkNotNull(file);
698 checkNotNull(mode);
699
700 Closer closer = Closer.create();
701 try {
702 RandomAccessFile raf =
703 closer.register(new RandomAccessFile(file, mode == MapMode.READ_ONLY ? "r" : "rw"));
704 FileChannel channel = closer.register(raf.getChannel());
705 return channel.map(mode, 0, size == -1 ? channel.size() : size);
706 } catch (Throwable e) {
707 throw closer.rethrow(e);
708 } finally {
709 closer.close();
710 }
711 }
712
713 /**
714 * Returns the lexically cleaned form of the path name, <i>usually</i> (but not always) equivalent

Callers 1

mapMethod · 0.95

Calls 7

createMethod · 0.95
registerMethod · 0.95
rethrowMethod · 0.95
closeMethod · 0.95
sizeMethod · 0.65
checkNotNullMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected