Class MagicComment


  • public class MagicComment
    extends java.lang.Object
    Utility for parsing "magic comments": a leading line in a file that contains metadata or settings like
     # -*- coding: utf-8; mode: java; tab-width: 4 -*-
     
    • Constructor Summary

      Constructors 
      Constructor Description
      MagicComment()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.String> parse​(java.io.File file)
      Extract the first line of the file and parse with #parse(String)
      static java.util.Map<java.lang.String,​java.lang.String> parse​(java.lang.String str)
      Parse magic comment
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MagicComment

        public MagicComment()
    • Method Detail

      • parse

        public static java.util.Map<java.lang.String,​java.lang.String> parse​(java.io.File file)
                                                                            throws java.io.IOException
        Extract the first line of the file and parse with #parse(String)
        Parameters:
        file -
        Returns:
        Throws:
        java.io.IOException
      • parse

        public static java.util.Map<java.lang.String,​java.lang.String> parse​(java.lang.String str)
        Parse magic comment
        Parameters:
        str - input string.
        Returns:
        Key-Value map of String.