Class MagicComment

java.lang.Object
org.omegat.util.MagicComment

public class MagicComment extends 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 Details

    • MagicComment

      public MagicComment()
  • Method Details

    • parse

      public static Map<String,String> parse(File file) throws IOException
      Extract the first line of the file and parse with #parse(String)
      Parameters:
      file - target file.
      Returns:
      Map with magic comment database.
      Throws:
      IOException - when I/O error happened.
    • parse

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