public class PropertiesHelper extends Object implements PropertyConverter
| Constructor and Description |
|---|
PropertiesHelper() |
PropertiesHelper(boolean unicodeEscaping) |
PropertiesHelper(boolean unicodeEscaping,
org.eclipse.emf.common.util.URI uri) |
| Modifier and Type | Method and Description |
|---|---|
static org.eclipse.emf.ecore.resource.ContentHandler.ByteOrderMark |
checkForBom(InputStream inputStream)
returns the BOM if available.
|
protected String |
deriveEncoding(org.eclipse.emf.ecore.resource.ContentHandler.ByteOrderMark bom) |
String |
getLicenseHeader() |
protected boolean |
isComment(String line) |
protected boolean |
isFilled(Property property) |
boolean |
isUnicodeEscaping() |
PropertyFile |
load(InputStream in,
String encoding)
loads the given input stream and transform it into a
PropertyFile
The implementation is expected to close the stream upon completion |
protected String |
parseComment(String line)
extracts the comment from the given line
|
Property |
readProperty(BufferedReader reader) |
protected String[] |
split(String propertyValue)
splits the property line into a key and value part
|
int |
write(OutputStream out,
PropertyFile file,
String encoding)
serializes the given
PropertyFile into the output steam
The implementation is expected to close the stream upon completion
The implementation is free to optimize the output by removing empty translations. |
protected void |
writeComment(Writer writer,
String comment) |
protected void |
writeCommentAndAnnotations(Writer writer,
Property property) |
void |
writeLicenseHeader(Writer writer,
String licenseHeader) |
void |
writeProperty(Writer writer,
Property property) |
public PropertiesHelper()
public PropertiesHelper(boolean unicodeEscaping)
public PropertiesHelper(boolean unicodeEscaping,
org.eclipse.emf.common.util.URI uri)
unicodeEscaping - uri - can be used to log the path of invalid files if suppliedpublic Property readProperty(BufferedReader reader) throws IOException
IOExceptionprotected String parseComment(String line)
line - protected String[] split(String propertyValue)
propertyValue - protected boolean isComment(String line)
public void writeProperty(Writer writer, Property property) throws IOException
IOExceptionprotected void writeCommentAndAnnotations(Writer writer, Property property) throws IOException
IOExceptionprotected void writeComment(Writer writer, String comment) throws IOException
IOExceptionpublic static org.eclipse.emf.ecore.resource.ContentHandler.ByteOrderMark checkForBom(InputStream inputStream) throws IOException
inputStream - must support mark/rest, or an IllegalArgumentException is thrownIOException, - IllegalArgumentExceptionIOExceptionpublic String getLicenseHeader()
public void writeLicenseHeader(Writer writer, String licenseHeader) throws IOException
IOExceptionpublic int write(OutputStream out, PropertyFile file, String encoding) throws IOException
PropertyConverterPropertyFile into the output steam
The implementation is expected to close the stream upon completion
The implementation is free to optimize the output by removing empty translations.
write in interface PropertyConverterencoding - hint about which encoding to useIOExceptionprotected boolean isFilled(Property property)
public PropertyFile load(InputStream in, String encoding) throws IOException
PropertyConverterPropertyFile
The implementation is expected to close the stream upon completion
load in interface PropertyConverterencoding - hint about which encoding to useIOExceptionprotected String deriveEncoding(org.eclipse.emf.ecore.resource.ContentHandler.ByteOrderMark bom)
public boolean isUnicodeEscaping()
Copyright © 2013–2014 Jabylon. All rights reserved.