public final class SpwlaFileReader extends Object
Typical usage:
SpwlaFileReader reader = new SpwlaFileReader(new File("path/to/file.spwla")); List<SpwlaFile> spwlaFiles = reader.read();
Constructor and Description |
---|
SpwlaFileReader(File file)
Create an SPWLA file reader for the specified disk file.
|
SpwlaFileReader(InputStream inputStream)
Create an SPWLA file reader for the specified stream.
|
Modifier and Type | Method and Description |
---|---|
static double |
isSpwlaFile(File file,
byte[] content)
Get the probability that the specified file is a SPWLA file.
|
List<SpwlaFile> |
read()
Read the SPWLA file and return its SpwlaFile internal representation.
|
public SpwlaFileReader(InputStream inputStream)
inputStream
- Stream to read. Non-null.IllegalArgumentException
- If inputStream is null.public SpwlaFileReader(File file)
file
- Disk file to read. Non-null.IllegalArgumentException
- If file is null.public static double isSpwlaFile(File file, byte[] content)
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:
File file = ...; BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file)); byte[] content = new byte[2000]; stream.read(content, 0, content.length); stream.close();
file
- File to check. Null to classify on content only.content
- A number of bytes from the start of the file.
Null to classify on file name only.public List<SpwlaFile> read() throws IOException
IOException
- If the read operation fails for some reason.Copyright © 2024 Petroware AS - https://petroware.no