public class TextEntitySource extends Object implements EntitySource, Describable
Entity reader that loads entities from text data, often stored in a file.
Constructor and Description |
---|
TextEntitySource()
Construct a new text entity source.
|
TextEntitySource(String name)
Construct a new text entity source.
|
Modifier and Type | Method and Description |
---|---|
void |
describeTo(DescriptionWriter writer)
Write this class’s description to a sink.
|
Path |
getFile()
Get the input file path.
|
EntityFormat |
getFormat()
Get the entity format for the reader.
|
Map<String,Object> |
getMetadata()
Get metadata from this entity source.
|
String |
getName()
Get the name of this data source.
|
Set<EntityType> |
getTypes()
Get the entity types produced by this source.
|
URL |
getURL()
Get the source file for this data source.
|
ObjectStream<Entity> |
openStream()
Open a stream to read entities from this source.
|
void |
setFile(Path file)
Set the source file for this reader.
|
void |
setFormat(EntityFormat format)
Set the entity format for the reader.
|
void |
setSource(CharSequence text)
Set a string from which to read entities.
|
void |
setURL(URL url)
Set the URL of the input data.
|
com.fasterxml.jackson.databind.JsonNode |
toJSON(URI base)
Construct a JSON representation of this entity source, suitable for serialization to e.g.
|
String |
toString() |
public TextEntitySource()
Construct a new text entity source.
public TextEntitySource(String name)
Construct a new text entity source.
name
- The source’s name.public String getName()
Get the name of this data source.
getName
in interface EntitySource
@Nonnull public Set<EntityType> getTypes()
EntitySource
Get the entity types produced by this source.
getTypes
in interface EntitySource
public void setFile(Path file)
Set the source file for this reader.
file
- The source file.public void setURL(URL url)
Set the URL of the input data.
url
- The URL of the input data.public Path getFile()
Get the input file path.
public URL getURL()
Get the source file for this data source.
public void setSource(CharSequence text)
Set a string from which to read entities.
public void setFormat(EntityFormat format)
Set the entity format for the reader.
format
- The entity format.public EntityFormat getFormat()
Get the entity format for the reader.
public Map<String,Object> getMetadata()
EntitySource
Get metadata from this entity source.
getMetadata
in interface EntitySource
public ObjectStream<Entity> openStream() throws IOException
Open a stream to read entities from this source.
openStream
in interface EntitySource
IOException
public void describeTo(DescriptionWriter writer)
Describable
Write this class’s description to a sink. Anything relevant to this object’s identity should be digested; the idea is that, barring hash collisions, two objects with the same digest are equivalent. Used for things like deterministically generating cache file names.
describeTo
in interface Describable
writer
- The description writer to use.