diff options
Diffstat (limited to 'lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java')
-rw-r--r-- | lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java index 0c2ee5a5cb..3414110a2c 100644 --- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java +++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java @@ -19,8 +19,8 @@ import java.io.FileFilter; import java.io.FileInputStream; import java.io.IOException; import java.io.Serializable; +import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.FileChannel.MapMode; import java.util.Arrays; @@ -44,6 +44,7 @@ import org.eclipse.linuxtools.ctf.core.event.types.IDefinition; import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition; import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration; import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition; +import org.eclipse.linuxtools.internal.ctf.core.SafeMappedByteBuffer; import org.eclipse.linuxtools.internal.ctf.core.event.CTFCallsiteComparator; import org.eclipse.linuxtools.internal.ctf.core.event.metadata.exceptions.ParseException; import org.eclipse.linuxtools.internal.ctf.core.event.types.ArrayDefinition; @@ -507,7 +508,7 @@ public class CTFTrace implements IDefinitionScope, AutoCloseable { * if there is a file error */ private CTFStream openStreamInput(File streamFile) throws CTFReaderException { - MappedByteBuffer byteBuffer; + ByteBuffer byteBuffer; BitBuffer streamBitBuffer; CTFStream stream; @@ -519,7 +520,7 @@ public class CTFTrace implements IDefinitionScope, AutoCloseable { try (FileInputStream fis = new FileInputStream(streamFile); FileChannel fc = fis.getChannel()) { /* Map one memory page of 4 kiB */ - byteBuffer = fc.map(MapMode.READ_ONLY, 0, (int) Math.min(fc.size(), 4096L)); + byteBuffer = SafeMappedByteBuffer.map(fc, MapMode.READ_ONLY, 0, (int) Math.min(fc.size(), 4096L)); if (byteBuffer == null) { throw new IllegalStateException("Failed to allocate memory"); //$NON-NLS-1$ } |