Class ReadAnnotationFromFile
Object
ReadAnnotationFromFile
Utility class for reading
ImageLabelAnnotation
from a file.-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional
<ImageLabelAnnotation> readAssumeExists
(Path path, OperationContext context) Reads anImageLabelAnnotation
from a file, assuming the file exists.static Optional
<ImageLabelAnnotation> readCheckExists
(Path path, OperationContext context) Reads anImageLabelAnnotation
from a file if it exists.
-
Method Details
-
readCheckExists
public static Optional<ImageLabelAnnotation> readCheckExists(Path path, OperationContext context) throws InputReadFailedException Reads anImageLabelAnnotation
from a file if it exists.- Parameters:
path
- thePath
to the file to read from.context
- theOperationContext
for the read operation.- Returns:
- an
Optional
containing theImageLabelAnnotation
if the file exists and can be read, or an empty Optional otherwise. - Throws:
InputReadFailedException
- if an error occurs while reading the file.
-
readAssumeExists
public static Optional<ImageLabelAnnotation> readAssumeExists(Path path, OperationContext context) throws InputReadFailedException Reads anImageLabelAnnotation
from a file, assuming the file exists.- Parameters:
path
- thePath
to the file to read from.context
- theOperationContext
for the read operation.- Returns:
- an
Optional
containing theImageLabelAnnotation
if it can be read, or an empty Optional otherwise. - Throws:
InputReadFailedException
- if an error occurs while reading the file.
-