Log I/O
Loading...
Searching...
No Matches
DlisFileReader Class Referencesealed

Class for reading DLIS files. More...

Public Member Functions

 DlisFileReader (FileInfo file)
 Create a DLIS file reader for the specified disk file.
 
 DlisFileReader (Stream inputStream)
 Create a DLIS file reader for the specified stream.
 
IList< DlisFileRead (bool shouldReadBulkData=true, bool shouldCaptureStatistics=false, IDlisDataListener dataListener=null, bool isGrowing=false)
 Read all DLIS files from the disk file of this reader.
 
void ReadData (IList< DlisFile > dlisFiles, bool shouldCaptureStatistics=false, IDlisDataListener dataListener=null, bool isGrowing=false)
 Read data from a set of DLIS files where the meta data has already been read.
 

Static Public Member Functions

static double IsDlisFile (FileInfo file, byte[] content=null)
 Get the probability that the specified file is a DLIS file.
 

Detailed Description

Class for reading DLIS files.

Typical usage:

    DlisFileReader reader = new DlisFileReader(new FileInfo("path/to/file"));
    IList<DlisFile> dlisFiles = reader.Read(true, false, null);

If the curve data is not needed, it is possible to read only the meta-data from the disk file. The curve data may be filled in later:

    DlisFileReader reader = new DlisFileReader(new FileInfo("path/to/file"));
    IList<DlisFile> dlisFiles = reader.Read(false);
    :
    reader.ReadData(dlisFiles);

Note that even if only meta-data is read, all frames and curve information are properly established as this information comes from meta-data. Only the curve values will be missing.

If disk files are larger than physical memory, it is possible to stream (process than throw away) the data during read. See IDlisDataListener. The same mechanism may be use to be able to abort the reading process during the operation.

See also
RP66 V1
Author
Petroware AS

Constructor & Destructor Documentation

◆ DlisFileReader() [1/2]

DlisFileReader ( Stream inputStream)

Create a DLIS file reader for the specified stream.

Parameters
inputStreamStream to read. Non-null.
Exceptions
ArgumentNullExceptionIf stream is null.

◆ DlisFileReader() [2/2]

DlisFileReader ( FileInfo file)

Create a DLIS file reader for the specified disk file.

Parameters
fileDisk file to read. Non-null.
Exceptions
ArgumentNullExceptionIf file is null.

Member Function Documentation

◆ IsDlisFile()

static double IsDlisFile ( FileInfo file,
byte[] content = null )
static

Get the probability that the specified file is a DLIS file.

The check can be done with or without considering the content of the file. In the latter case, only the file name (typically its extension) is considered. In the former case a portion from the start of the file is used to match for known patterns. By passing the portion as an argument, the client code can read this once and then pass it to different classifiers in order to determine its most likely type.

Getting a portion of a file can be done by:

    FileInfo file = ...;
    BinaryReader reader = new BinaryReader(file.OpenRead());
    byte[] content = new byte[2000]; //say
    reader.Read(content, 0, content.Length);
    reader.Close();
Parameters
fileFile to check. Null to classify on content only.
contentA number of bytes from the start of the file. Null to classify on file name only.
Returns
Probability that the file is a DLIS file. [0.0,1.0].

◆ Read()

IList< DlisFile > Read ( bool shouldReadBulkData = true,
bool shouldCaptureStatistics = false,
IDlisDataListener dataListener = null,
bool isGrowing = false )

Read all DLIS files from the disk file of this reader.

Parameters
shouldReadBulkDataIndicate if bulk data should be read. False to read header data only.
shouldCaptureStatisticsTrue to capture statistics per curve. Statistics capture will reduce read performance slightly, so set this to false if the statistics are not needed.
dataListenerListener that will be notified when new data has been read. Null if not used.
isGrowingIndicates that the file is live and might be growing, so keep the process running until the stream is closed by the client.
Returns
List of the logical DLIS files contained in the file. Never null.
Exceptions
IOExceptionIf the read operation fails for some reason.
OperationCanceledExceptionIf the client returns false from the IDlisDataListener.DataRead method.

◆ ReadData()

void ReadData ( IList< DlisFile > dlisFiles,
bool shouldCaptureStatistics = false,
IDlisDataListener dataListener = null,
bool isGrowing = false )

Read data from a set of DLIS files where the meta data has already been read.

This will preserve the existing DlisFile structure in case a DLIS file is read in two operations:

   // Read meta data
   IList<DlisFile> dlisFiles = reader.Read(false);

   // Read the curve data
   reader.ReadData(dlisFiles);

There is nothing to gain in performance with this approach so in case the result is not cached, the following is equivalent:

  // Read meta data
  List<DlisFile> dlisFiles = reader.Read(false);

  // Read the curve data
  dlisFiles = reader.Read(true);
Parameters
dlisFilesThe DLIS files to populate. These must be the exact same list as retrieved by calling the Read(false,...) on the same DlisFileReader instance. Otherwise the behavior is unpredictable.
shouldCaptureStatisticsTrue to capture statistics per curve during read. Statistics capture will reduce read performance slightly, so set this to false if the statistics are not needed.
dataListenerListener that will be notified when new data has been read. Null if not used.
isGrowingIndicates that the file is live and might be growing, so keep the process running until the stream is closed by the client.
Exceptions
ArgumentNullExceptionIf dlisFiles is null.
IOExceptionIf the read operation fails for some reason.
OperationCanceledExceptionIf the client returns false from the IDlisDataListener.DataRead method.

The documentation for this class was generated from the following file: