Add named FullDataMetaFile constructors
This commit is contained in:
+3
-3
@@ -84,7 +84,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
|
||||
@Override
|
||||
public void addScannedFiles(Collection<File> detectedFiles)
|
||||
{
|
||||
MetaFileScanUtil.CreateMetadataFunc createMetadataFunc = (file) -> new FullDataMetaFile(this, this.level, file);
|
||||
MetaFileScanUtil.CreateMetadataFunc createMetadataFunc = (file) -> FullDataMetaFile.createFromExistingFile(this, this.level, file);
|
||||
|
||||
MetaFileScanUtil.AddUnloadedFileFunc addUnloadedFileFunc = (pos, file) ->
|
||||
{
|
||||
@@ -173,7 +173,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
|
||||
|
||||
try
|
||||
{
|
||||
metaFile = new FullDataMetaFile(this, this.level, fileToLoad);
|
||||
metaFile = FullDataMetaFile.createFromExistingFile(this, this.level, fileToLoad);
|
||||
this.topDetailLevelRef.updateAndGet(oldDetailLevel -> Math.max(oldDetailLevel, pos.sectionDetailLevel));
|
||||
this.metaFileBySectionPos.put(pos, metaFile);
|
||||
return metaFile;
|
||||
@@ -201,7 +201,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
|
||||
// to avoid overhead of 'synchronized', and eat the mini-overhead of possibly creating duplicate objects.
|
||||
try
|
||||
{
|
||||
metaFile = new FullDataMetaFile(this, this.level, pos);
|
||||
metaFile = FullDataMetaFile.createNewFileForPos(this, this.level, pos);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
+10
-7
@@ -34,6 +34,8 @@ import com.seibel.distanthorizons.core.dataObjects.fullData.accessor.ChunkSizedF
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.interfaces.IFullDataSource;
|
||||
import com.seibel.distanthorizons.core.file.metaData.AbstractMetaDataContainerFile;
|
||||
import com.seibel.distanthorizons.core.file.metaData.BaseMetaData;
|
||||
import com.seibel.distanthorizons.core.file.renderfile.RenderMetaDataFile;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhLodPos;
|
||||
@@ -182,11 +184,11 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile implements I
|
||||
//==============//
|
||||
|
||||
/**
|
||||
* Creates a new file.
|
||||
*
|
||||
* @throws FileAlreadyExistsException if a file already exists.
|
||||
* NOTE: should only be used if there is NOT an existing file.
|
||||
* @throws IOException if a file already exists for this position
|
||||
*/
|
||||
public FullDataMetaFile(IFullDataSourceProvider fullDataSourceProvider, IDhLevel level, DhSectionPos pos) throws FileAlreadyExistsException
|
||||
public static FullDataMetaFile createNewFileForPos(IFullDataSourceProvider fullDataSourceProvider, IDhLevel clientLevel, DhSectionPos pos) throws IOException { return new FullDataMetaFile(fullDataSourceProvider, clientLevel, pos); }
|
||||
private FullDataMetaFile(IFullDataSourceProvider fullDataSourceProvider, IDhLevel level, DhSectionPos pos) throws IOException
|
||||
{
|
||||
super(fullDataSourceProvider.computeDataFilePath(pos), pos);
|
||||
debugPhantomLifeCycleCheck();
|
||||
@@ -198,13 +200,14 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile implements I
|
||||
DebugRenderer.register(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Uses an existing file.
|
||||
*
|
||||
* NOTE: should only be used if there IS an existing file.
|
||||
* @throws IOException if the file was formatted incorrectly
|
||||
* @throws FileNotFoundException if no file exists for the given path
|
||||
*/
|
||||
public FullDataMetaFile(IFullDataSourceProvider fullDataSourceProvider, IDhLevel level, File file) throws IOException, FileNotFoundException
|
||||
public static FullDataMetaFile createFromExistingFile(IFullDataSourceProvider fullDataSourceProvider, IDhLevel level, File file) throws IOException { return new FullDataMetaFile(fullDataSourceProvider, level, file); }
|
||||
private FullDataMetaFile(IFullDataSourceProvider fullDataSourceProvider, IDhLevel level, File file) throws IOException, FileNotFoundException
|
||||
{
|
||||
super(file);
|
||||
debugPhantomLifeCycleCheck();
|
||||
|
||||
Reference in New Issue
Block a user