public class MetaFile extends Object implements org.apache.jena.atlas.lib.Sync, org.apache.jena.atlas.lib.Closeable
| Constructor and Description |
|---|
MetaFile(String label,
String fn)
Create a MetaFile
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkMetadata(String key,
String expected)
Check property has the value given - throw exception if not.
|
void |
checkOrSetMetadata(String key,
String expected)
Check property is an expected value or set if missing
|
void |
clear()
Clear all properties.
|
void |
close() |
void |
dump(PrintStream output)
Debugging
|
void |
ensurePropertySet(String key,
String expected)
Set property if not already set.
|
boolean |
existsMetaData()
Does this metafile exist on disk? (In-memory MetaFiles always exist)
|
void |
flush()
Write to backing file if changed
|
String |
getFilename() |
String |
getOrSetDefault(String key,
String expected)
Get property or the default value - also set the default value if not present
|
String |
getProperty(String key)
Get the property value or null.
|
String |
getProperty(String key,
String defaultString)
Get the property value or return supplied default.
|
int |
getPropertyAsInteger(String key)
Get the property value and parse as an integer
|
int |
getPropertyAsInteger(String key,
int defaultValue)
Get the property value and parse as an integer or return default value.
|
String[] |
getPropertySplit(String key)
Get property as a string and split on ",".
|
String[] |
getPropertySplit(String key,
String defaultString)
Get property as a string and split on ",", using the default string if not present in the MetaFile.
|
boolean |
hasProperty(String key)
Test for the presence of a property
|
boolean |
propertyEquals(String key,
String value)
Test whether a property has a value.
|
void |
setProperty(String key,
int value)
Set property, turning integer into a string.
|
void |
setProperty(String key,
String value)
Set property
|
void |
sync() |
public MetaFile(String label, String fn)
label - Convenience label.fn - On disk filename; Names.memName for in-memorypublic boolean existsMetaData()
public String getFilename()
public boolean hasProperty(String key)
public String getProperty(String key, String defaultString)
public int getPropertyAsInteger(String key)
public int getPropertyAsInteger(String key, int defaultValue)
public String[] getPropertySplit(String key)
public String[] getPropertySplit(String key, String defaultString)
public void setProperty(String key, int value)
public boolean propertyEquals(String key, String value)
public void ensurePropertySet(String key, String expected)
public String getOrSetDefault(String key, String expected)
public void checkOrSetMetadata(String key, String expected)
public void checkMetadata(String key, String expected)
public void clear()
public void flush()
public void dump(PrintStream output)
public void sync()
sync in interface org.apache.jena.atlas.lib.Syncpublic void close()
close in interface org.apache.jena.atlas.lib.CloseableLicensed under the Apache License, Version 2.0