Class PropertiesHelper

    • Constructor Detail

      • PropertiesHelper

        public PropertiesHelper()
      • PropertiesHelper

        public PropertiesHelper​(boolean unicodeEscaping)
      • PropertiesHelper

        public PropertiesHelper​(boolean unicodeEscaping,
                                org.eclipse.emf.common.util.URI uri)
        Parameters:
        unicodeEscaping -
        uri - can be used to log the path of invalid files if supplied
    • Method Detail

      • parseComment

        protected String parseComment​(String line)
        extracts the comment from the given line
        Parameters:
        line -
        Returns:
        the comment content
      • split

        protected String[] split​(String propertyValue)
        splits the property line into a key and value part
        Parameters:
        propertyValue -
        Returns:
      • isComment

        protected boolean isComment​(String line)
      • checkForBom

        public static org.eclipse.emf.ecore.resource.ContentHandler.ByteOrderMark checkForBom​(InputStream inputStream)
                                                                                       throws IOException
        returns the BOM if available. If no BOM was found the stream is reset to its original state
        Parameters:
        inputStream - must support mark/rest, or an IllegalArgumentException is thrown
        Returns:
        Throws:
        IOException
      • getLicenseHeader

        public String getLicenseHeader()
      • write

        public int write​(OutputStream out,
                         PropertyFile file,
                         String encoding)
                  throws IOException
        Description copied from interface: PropertyConverter
        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.

        Specified by:
        write in interface PropertyConverter
        encoding - hint about which encoding to use
        Returns:
        number of translated (non-empty) keys
        Throws:
        IOException
      • isFilled

        protected boolean isFilled​(Property property)
      • deriveEncoding

        protected String deriveEncoding​(org.eclipse.emf.ecore.resource.ContentHandler.ByteOrderMark bom)
      • isUnicodeEscaping

        public boolean isUnicodeEscaping()