/** * Create a new file, fill with 0s, and return a {@link java.nio.MappedByteBuffer} for the file. * <p> * The file itself will be closed, but the mapping will persist. * * @param location of the file to create and map * @param length of the file to create and map * @return {@link java.nio.MappedByteBuffer} for the file */ public static MappedByteBuffer mapNewFile(final File location, final long length) { return mapNewFile(location, length, true); }
/** * Map a new loss report in the Aeron directory for a given length. * * @param aeronDirectoryName in which to create the file. * @param reportFileLength for the file. * @return the newly mapped buffer for the file. */ public static MappedByteBuffer mapLossReport(final String aeronDirectoryName, final int reportFileLength) { return mapNewFile(file(aeronDirectoryName), reportFileLength, false); } }
private void createFile(final long correlationId, final long length, final String filename) { if (fileSessionByIdMap.containsKey(correlationId)) { throw new IllegalStateException("correlationId is in use: " + correlationId); } final File file = new File(storageDir, filename); if (file.exists() && !file.delete()) { throw new IllegalStateException("failed to delete existing file: " + file); } if (length == 0) { try { if (!file.createNewFile()) { throw new IllegalStateException("failed to create " + filename); } } catch (final IOException ex) { LangUtil.rethrowUnchecked(ex); } } else { fileSessionByIdMap.put(correlationId, new UnsafeBuffer(IoUtil.mapNewFile(file, length, false))); } }
this.mappedBuffer = IoUtil.mapNewFile(markFile, totalFileLength); this.buffer = new UnsafeBuffer(mappedBuffer); this.versionFieldOffset = versionFieldOffset;
cncByteBuffer = mapNewFile( cncFile(), CncFileDescriptor.computeCncFileLength(
/** * Create a new file, fill with 0s, and return a {@link java.nio.MappedByteBuffer} for the file. * <p> * The file itself will be closed, but the mapping will persist. * * @param location of the file to create and map * @param length of the file to create and map * @return {@link java.nio.MappedByteBuffer} for the file */ public static MappedByteBuffer mapNewFile(final File location, final long length) { return mapNewFile(location, length, true); }
/** * Map a new loss report in the Aeron directory for a given length. * * @param aeronDirectoryName in which to create the file. * @param reportFileLength for the file. * @return the newly mapped buffer for the file. */ public static MappedByteBuffer mapLossReport(final String aeronDirectoryName, final int reportFileLength) { return mapNewFile(file(aeronDirectoryName), reportFileLength, false); } }
/** * Map a new loss report in the Aeron directory for a given length. * * @param aeronDirectoryName in which to create the file. * @param reportFileLength for the file. * @return the newly mapped buffer for the file. */ public static MappedByteBuffer mapLossReport(final String aeronDirectoryName, final int reportFileLength) { return mapNewFile(file(aeronDirectoryName), reportFileLength, false); } }
public static MappedByteBuffer mapNewFile(final File file, final int size) { final File parentDir = file.getParentFile(); IoUtil.ensureDirectoryExists(parentDir, parentDir.getAbsolutePath()); return IoUtil.mapNewFile(file, size); }
@Override public void initialize(File monitoringFile) { int fileSize = computeMonitorTotalFileLength(); mappedMonitorFile = IoUtil.mapNewFile(monitoringFile, fileSize); metaDataBuffer = new UnsafeBuffer(mappedMonitorFile, 0, metadataLength + BitUtil.SIZE_OF_INT); fillMetaData(); }
this.mappedBuffer = IoUtil.mapNewFile(markFile, totalFileLength); this.buffer = new UnsafeBuffer(mappedBuffer); this.versionFieldOffset = versionFieldOffset;
cncByteBuffer = mapNewFile( cncFile(), CncFileDescriptor.computeCncFileLength(
cncByteBuffer = mapNewFile( cncFile(), CncFileDescriptor.computeCncFileLength(