Source:
<code>private void openStreamInput(File streamFile) throws CTFReaderException { ByteBuffer byteBuffer; BitBuffer streamBitBuffer; Stream stream; FileChannel fc; if (!streamFile.canRead()) { throw new CTFReaderException("Unreadable file : " + streamFile.getPath()); } try { FileInputStream fis = new FileInputStream(streamFile); fileInputStreams.add(fis); fc = fis.getChannel(); <START> byteBuffer = ByteBuffer.allocate(Math.min((int)fc.size(), 4096)); <END> fc.read(byteBuffer); } catch (IOException e) { throw new CTFReaderException(); } streamBitBuffer = new BitBuffer(byteBuffer, this.getByteOrder()); if (packetHeaderDef != null) { packetHeaderDef.read(streamBitBuffer); IntegerDefinition magicDef = (IntegerDefinition) packetHeaderDef .lookupDefinition("magic"); int magic = (int) magicDef.getValue(); if (magic != Utils.CTF_MAGIC) { throw new CTFReaderException("CTF magic mismatch"); } ArrayDefinition uuidDef = (ArrayDefinition) packetHeaderDef .lookupDefinition("uuid"); if (uuidDef != null) { byte[] uuidArray = new byte[Utils.UUID_LEN]; for (int i = 0; i < Utils.UUID_LEN; i++) { IntegerDefinition uuidByteDef = (IntegerDefinition) uuidDef .getElem(i); uuidArray[i] = (byte) uuidByteDef.getValue(); } UUID otheruuid = Utils.makeUUID(uuidArray); if (!this.uuid.equals(otheruuid)) { throw new CTFReaderException("UUID mismatch"); } } Definition streamIDDef = packetHeaderDef.lookupDefinition("stream_id"); if (streamIDDef instanceof IntegerDefinition) { long streamID = ((IntegerDefinition) streamIDDef).getValue(); stream = streams.get(streamID); } else { stream = streams.get(null); } } else { stream = streams.get(null); } if (stream == null) { throw new CTFReaderException("Unexpected end of stream"); } StreamInput streamInput = new StreamInput(stream, fc, streamFile); stream.addInput(streamInput); }</code><technical_language>need benchmark this accepting change</technical_language>

Target:
private void openStreamInput(File streamFile) throws CTFReaderException { MappedByteBuffer byteBuffer; BitBuffer streamBitBuffer; Stream stream; FileChannel fc; if (!streamFile.canRead()) { throw new CTFReaderException("Unreadable file : " + streamFile.getPath()); } try { FileInputStream fis = new FileInputStream(streamFile); fileInputStreams.add(fis); fc = fis.getChannel(); byteBuffer = fc.map(MapMode.READ_ONLY, 0, Math.min((int)fc.size(), 4096)); } catch (IOException e) { throw new CTFReaderException(); } streamBitBuffer = new BitBuffer(byteBuffer, this.getByteOrder()); if (packetHeaderDef != null) { packetHeaderDef.read(streamBitBuffer); IntegerDefinition magicDef = (IntegerDefinition) packetHeaderDef .lookupDefinition("magic"); int magic = (int) magicDef.getValue(); if (magic != Utils.CTF_MAGIC) { throw new CTFReaderException("CTF magic mismatch"); } ArrayDefinition uuidDef = (ArrayDefinition) packetHeaderDef .lookupDefinition("uuid"); if (uuidDef != null) { byte[] uuidArray = new byte[Utils.UUID_LEN]; for (int i = 0; i < Utils.UUID_LEN; i++) { IntegerDefinition uuidByteDef = (IntegerDefinition) uuidDef .getElem(i); uuidArray[i] = (byte) uuidByteDef.getValue(); } UUID otheruuid = Utils.makeUUID(uuidArray); if (!this.uuid.equals(otheruuid)) { throw new CTFReaderException("UUID mismatch"); } } Definition streamIDDef = packetHeaderDef.lookupDefinition("stream_id"); if (streamIDDef instanceof IntegerDefinition) { long streamID = ((IntegerDefinition) streamIDDef).getValue(); stream = streams.get(streamID); } else { stream = streams.get(null); } } else { stream = streams.get(null); } if (stream == null) { throw new CTFReaderException("Unexpected end of stream"); } StreamInput streamInput = new StreamInput(stream, fc, streamFile); stream.addInput(streamInput); }