Package org.daisy.braille.utils.pef
Class TextHandler.Builder
- java.lang.Object
-
- org.daisy.braille.utils.pef.TextHandler.Builder
-
- Enclosing class:
- TextHandler
public static class TextHandler.Builder extends Object
Provides a Builder for TextHandler.
-
-
Constructor Summary
Constructors Constructor Description Builder(File input, File output, TableCatalogService factory)Create a new TextParser builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextHandler.Builderauthor(String value)Sets the author for publications created using TextHandlers created with this builder.TextHandlerbuild()Builds a TextParser using the settings of this Builder.TextHandler.BuilderconverterId(String value)Sets the converter identifier to be used when creating a TextHandler.TextHandler.Builderdate(Date value)Sets the date for publications created using TextHandlers created with this builder.TextHandler.Builderduplex(boolean value)Sets the duplex property for publications created using TextHandlers created with this builder.TextHandler.Builderidentifier(String value)Sets the identifier for publications created using TextHandlers created with this builder.TextHandler.Builderlanguage(String value)Sets the language for publications created using TextHandlers created with this builder.TextHandler.Builderoptions(Map<String,String> settings)Sets options from a map.voidparse()Parses the input file with the current settings.TextHandler.Buildertitle(String value)Sets the title for publications created using TextHandlers created with this builder.
-
-
-
Constructor Detail
-
Builder
public Builder(File input, File output, TableCatalogService factory)
Create a new TextParser builder.- Parameters:
input- the inputoutput- the outputfactory- the table catalog
-
-
Method Detail
-
options
public TextHandler.Builder options(Map<String,String> settings)
Sets options from a map.- Parameters:
settings- the settings.- Returns:
- returns this object
- Throws:
IllegalArgumentException- if a key is unknown or if a value doesn't meet the requirements.
-
title
public TextHandler.Builder title(String value)
Sets the title for publications created using TextHandlers created with this builder.- Parameters:
value- the title- Returns:
- returns this object
-
author
public TextHandler.Builder author(String value)
Sets the author for publications created using TextHandlers created with this builder.- Parameters:
value- the author- Returns:
- returns this object
-
language
public TextHandler.Builder language(String value)
Sets the language for publications created using TextHandlers created with this builder.- Parameters:
value- the language- Returns:
- returns this object
-
identifier
public TextHandler.Builder identifier(String value)
Sets the identifier for publications created using TextHandlers created with this builder.- Parameters:
value- the identifier- Returns:
- returns this object
-
converterId
public TextHandler.Builder converterId(String value)
Sets the converter identifier to be used when creating a TextHandler. See TableCatalog for available values. If none is suppled, the builder will attempt to select one based on file input characteristics.- Parameters:
value- the identifier for the converter- Returns:
- returns this object
-
duplex
public TextHandler.Builder duplex(boolean value)
Sets the duplex property for publications created using TextHandlers created with this builder.- Parameters:
value- the duplex value- Returns:
- returns this object
-
date
public TextHandler.Builder date(Date value)
Sets the date for publications created using TextHandlers created with this builder.- Parameters:
value- the date to use- Returns:
- returns this object
-
build
public TextHandler build() throws IOException, InputDetectionException
Builds a TextParser using the settings of this Builder.- Returns:
- returns a new TextParser
- Throws:
IOException- if an error occursInputDetectionException- if an error occursUnsupportedEncodingException- if an error occurs
-
parse
public void parse() throws InputDetectionException, IOExceptionParses the input file with the current settings.- Throws:
InputDetectionException- if an error occursIOException- if an error occurs
-
-