Class FileUtility
- java.lang.Object
-
- org.openstreetmap.atlas.checks.utility.FileUtility
-
public final class FileUtility extends java.lang.ObjectA set of utility classes for reading files
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileUtility.LogOutputFileTypeAn enum containing the different types of input files that we can handle.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<FileUtility.LogOutputFileType>getOptionalLogOutputType(org.openstreetmap.atlas.streaming.resource.File logFile)Determine whether or not this file is something we can handle, and classify it accordingly.static java.io.BufferedReadergetReader(org.openstreetmap.atlas.streaming.resource.File inputFile, FileUtility.LogOutputFileType fileType)Read a file that we know we should be able to handle
-
-
-
Method Detail
-
getOptionalLogOutputType
public static java.util.Optional<FileUtility.LogOutputFileType> getOptionalLogOutputType(org.openstreetmap.atlas.streaming.resource.File logFile)
Determine whether or not this file is something we can handle, and classify it accordingly.- Parameters:
logFile- any file- Returns:
- if this file is something this command can handle, the appropriate LogOutputFileType enum value; otherwise, an empty optional.
-
getReader
public static java.io.BufferedReader getReader(org.openstreetmap.atlas.streaming.resource.File inputFile, FileUtility.LogOutputFileType fileType) throws java.io.IOExceptionRead a file that we know we should be able to handle- Parameters:
inputFile- Some file with a valid, appropriate extension.fileType- The type of file that inputFile is- Returns:
- a BufferedReader to read inputFile
- Throws:
java.io.IOException- if the file is not found or is poorly formatted, given its extension. For example, if this file is gzipped and something goes wrong in the unzipping process, it might throw an error
-
-