OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libjava/] [classpath/] [java/] [net/] [MimeTypeMapper.java] - Diff between revs 771 and 783

Only display areas with differences | Details | Blame | View Log

Rev 771 Rev 783
/* MimeTypeMapper.java -- A class for mapping file names to MIME types
/* MimeTypeMapper.java -- A class for mapping file names to MIME types
   Copyright (C) 1998 Free Software Foundation, Inc.
   Copyright (C) 1998 Free Software Foundation, Inc.
 
 
This file is part of GNU Classpath.
This file is part of GNU Classpath.
 
 
GNU Classpath is free software; you can redistribute it and/or modify
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
any later version.
 
 
GNU Classpath is distributed in the hope that it will be useful, but
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
02110-1301 USA.
 
 
Linking this library statically or dynamically with other modules is
Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
conditions of the GNU General Public License cover the whole
combination.
combination.
 
 
As a special exception, the copyright holders of this library give you
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */
exception statement from your version. */
 
 
package java.net;
package java.net;
 
 
import gnu.classpath.SystemProperties;
import gnu.classpath.SystemProperties;
 
 
import java.io.FileReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.LineNumberReader;
import java.util.Hashtable;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Iterator;
import java.util.Map;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeMap;
 
 
 
 
/**
/**
 * This non-public class is used to implement the FileNameMap interface
 * This non-public class is used to implement the FileNameMap interface
 * which defines a mechanism for mapping filenames to MIME types.
 * which defines a mechanism for mapping filenames to MIME types.
 *
 *
 * @version 0.5
 * @version 0.5
 *
 *
 * @author Aaron M. Renn (arenn@urbanophile.com)
 * @author Aaron M. Renn (arenn@urbanophile.com)
 */
 */
class MimeTypeMapper implements FileNameMap
class MimeTypeMapper implements FileNameMap
{
{
  /**
  /**
   * This array of strings is used to identify a MIME type based on a file
   * This array of strings is used to identify a MIME type based on a file
   * extension.  This is list is based on the Apache mime.types file.
   * extension.  This is list is based on the Apache mime.types file.
   */
   */
  protected static final String[][] mime_strings =
  protected static final String[][] mime_strings =
    {
    {
       { "ai", "application/postscript" }
       { "ai", "application/postscript" }
     , { "aif", "audio/x-aiff" }
     , { "aif", "audio/x-aiff" }
     , { "aifc", "audio/x-aiff" }
     , { "aifc", "audio/x-aiff" }
     , { "aiff", "audio/x-aiff" }
     , { "aiff", "audio/x-aiff" }
     , { "asc", "text/plain" }
     , { "asc", "text/plain" }
     , { "au", "audio/basic" }
     , { "au", "audio/basic" }
     , { "avi", "video/x-msvideo" }
     , { "avi", "video/x-msvideo" }
     , { "bcpio", "application/x-bcpio" }
     , { "bcpio", "application/x-bcpio" }
     , { "bin", "application/octet-stream" }
     , { "bin", "application/octet-stream" }
     , { "bmp", "image/bmp" }
     , { "bmp", "image/bmp" }
     , { "bz2", "application/x-bzip2" }
     , { "bz2", "application/x-bzip2" }
     , { "cdf", "application/x-netcdf" }
     , { "cdf", "application/x-netcdf" }
     , { "chrt", "application/x-kchart" }
     , { "chrt", "application/x-kchart" }
     , { "class", "application/octet-stream" }
     , { "class", "application/octet-stream" }
     , { "cpio", "application/x-cpio" }
     , { "cpio", "application/x-cpio" }
     , { "cpt", "application/mac-compactpro" }
     , { "cpt", "application/mac-compactpro" }
     , { "csh", "application/x-csh" }
     , { "csh", "application/x-csh" }
     , { "css", "text/css" }
     , { "css", "text/css" }
     , { "dcr", "application/x-director" }
     , { "dcr", "application/x-director" }
     , { "dir", "application/x-director" }
     , { "dir", "application/x-director" }
     , { "djv", "image/vnd.djvu" }
     , { "djv", "image/vnd.djvu" }
     , { "djvu", "image/vnd.djvu" }
     , { "djvu", "image/vnd.djvu" }
     , { "dll", "application/octet-stream" }
     , { "dll", "application/octet-stream" }
     , { "dms", "application/octet-stream" }
     , { "dms", "application/octet-stream" }
     , { "doc", "application/msword" }
     , { "doc", "application/msword" }
     , { "dvi", "application/x-dvi" }
     , { "dvi", "application/x-dvi" }
     , { "dxr", "application/x-director" }
     , { "dxr", "application/x-director" }
     , { "eps", "application/postscript" }
     , { "eps", "application/postscript" }
     , { "etx", "text/x-setext" }
     , { "etx", "text/x-setext" }
     , { "exe", "application/octet-stream" }
     , { "exe", "application/octet-stream" }
     , { "ez", "application/andrew-inset" }
     , { "ez", "application/andrew-inset" }
     , { "gif", "image/gif" }
     , { "gif", "image/gif" }
     , { "gtar", "application/x-gtar" }
     , { "gtar", "application/x-gtar" }
     , { "gz", "application/x-gzip" }
     , { "gz", "application/x-gzip" }
     , { "hdf", "application/x-hdf" }
     , { "hdf", "application/x-hdf" }
     , { "hqx", "application/mac-binhex40" }
     , { "hqx", "application/mac-binhex40" }
     , { "htm", "text/html" }
     , { "htm", "text/html" }
     , { "html", "text/html" }
     , { "html", "text/html" }
     , { "ice", "x-conference/x-cooltalk" }
     , { "ice", "x-conference/x-cooltalk" }
     , { "ief", "image/ief" }
     , { "ief", "image/ief" }
     , { "iges", "model/iges" }
     , { "iges", "model/iges" }
     , { "igs", "model/iges" }
     , { "igs", "model/iges" }
     , { "img", "application/octet-stream" }
     , { "img", "application/octet-stream" }
     , { "iso", "application/octet-stream" }
     , { "iso", "application/octet-stream" }
     , { "jpe", "image/jpeg" }
     , { "jpe", "image/jpeg" }
     , { "jpeg", "image/jpeg" }
     , { "jpeg", "image/jpeg" }
     , { "jpg", "image/jpeg" }
     , { "jpg", "image/jpeg" }
     , { "js", "application/x-javascript" }
     , { "js", "application/x-javascript" }
     , { "kar", "audio/midi" }
     , { "kar", "audio/midi" }
     , { "kil", "application/x-killustrator" }
     , { "kil", "application/x-killustrator" }
     , { "kpr", "application/x-kpresenter" }
     , { "kpr", "application/x-kpresenter" }
     , { "kpt", "application/x-kpresenter" }
     , { "kpt", "application/x-kpresenter" }
     , { "ksp", "application/x-kspread" }
     , { "ksp", "application/x-kspread" }
     , { "kwd", "application/x-kword" }
     , { "kwd", "application/x-kword" }
     , { "kwt", "application/x-kword" }
     , { "kwt", "application/x-kword" }
     , { "latex", "application/x-latex" }
     , { "latex", "application/x-latex" }
     , { "lha", "application/octet-stream" }
     , { "lha", "application/octet-stream" }
     , { "lzh", "application/octet-stream" }
     , { "lzh", "application/octet-stream" }
     , { "m3u", "audio/x-mpegurl" }
     , { "m3u", "audio/x-mpegurl" }
     , { "man", "application/x-troff-man" }
     , { "man", "application/x-troff-man" }
     , { "me", "application/x-troff-me" }
     , { "me", "application/x-troff-me" }
     , { "mesh", "model/mesh" }
     , { "mesh", "model/mesh" }
     , { "mid", "audio/midi" }
     , { "mid", "audio/midi" }
     , { "midi", "audio/midi" }
     , { "midi", "audio/midi" }
     , { "mif", "application/vnd.mif" }
     , { "mif", "application/vnd.mif" }
     , { "mov", "video/quicktime" }
     , { "mov", "video/quicktime" }
     , { "movie", "video/x-sgi-movie" }
     , { "movie", "video/x-sgi-movie" }
     , { "mp2", "audio/mpeg" }
     , { "mp2", "audio/mpeg" }
     , { "mp3", "audio/mpeg" }
     , { "mp3", "audio/mpeg" }
     , { "mpe", "video/mpeg" }
     , { "mpe", "video/mpeg" }
     , { "mpeg", "video/mpeg" }
     , { "mpeg", "video/mpeg" }
     , { "mpg", "video/mpeg" }
     , { "mpg", "video/mpeg" }
     , { "mpga", "audio/mpeg" }
     , { "mpga", "audio/mpeg" }
     , { "ms", "application/x-troff-ms" }
     , { "ms", "application/x-troff-ms" }
     , { "msh", "model/mesh" }
     , { "msh", "model/mesh" }
     , { "mxu", "video/vnd.mpegurl" }
     , { "mxu", "video/vnd.mpegurl" }
     , { "nc", "application/x-netcdf" }
     , { "nc", "application/x-netcdf" }
     , { "ogg", "application/ogg" }
     , { "ogg", "application/ogg" }
     , { "pbm", "image/x-portable-bitmap" }
     , { "pbm", "image/x-portable-bitmap" }
     , { "pdb", "chemical/x-pdb" }
     , { "pdb", "chemical/x-pdb" }
     , { "pdf", "application/pdf" }
     , { "pdf", "application/pdf" }
     , { "pgm", "image/x-portable-graymap" }
     , { "pgm", "image/x-portable-graymap" }
     , { "pgn", "application/x-chess-pgn" }
     , { "pgn", "application/x-chess-pgn" }
     , { "png", "image/png" }
     , { "png", "image/png" }
     , { "pnm", "image/x-portable-anymap" }
     , { "pnm", "image/x-portable-anymap" }
     , { "ppm", "image/x-portable-pixmap" }
     , { "ppm", "image/x-portable-pixmap" }
     , { "ppt", "application/vnd.ms-powerpoint" }
     , { "ppt", "application/vnd.ms-powerpoint" }
     , { "ps", "application/postscript" }
     , { "ps", "application/postscript" }
     , { "qt", "video/quicktime" }
     , { "qt", "video/quicktime" }
     , { "ra", "audio/x-realaudio" }
     , { "ra", "audio/x-realaudio" }
     , { "ram", "audio/x-pn-realaudio" }
     , { "ram", "audio/x-pn-realaudio" }
     , { "ras", "image/x-cmu-raster" }
     , { "ras", "image/x-cmu-raster" }
     , { "rgb", "image/x-rgb" }
     , { "rgb", "image/x-rgb" }
     , { "rm", "audio/x-pn-realaudio" }
     , { "rm", "audio/x-pn-realaudio" }
     , { "roff", "application/x-troff" }
     , { "roff", "application/x-troff" }
     , { "rpm", "application/x-rpm" }
     , { "rpm", "application/x-rpm" }
     , { "rtf", "text/rtf" }
     , { "rtf", "text/rtf" }
     , { "rtx", "text/richtext" }
     , { "rtx", "text/richtext" }
     , { "sgm", "text/sgml" }
     , { "sgm", "text/sgml" }
     , { "sgml", "text/sgml" }
     , { "sgml", "text/sgml" }
     , { "sh", "application/x-sh" }
     , { "sh", "application/x-sh" }
     , { "shar", "application/x-shar" }
     , { "shar", "application/x-shar" }
     , { "silo", "model/mesh" }
     , { "silo", "model/mesh" }
     , { "sit", "application/x-stuffit" }
     , { "sit", "application/x-stuffit" }
     , { "skd", "application/x-koan" }
     , { "skd", "application/x-koan" }
     , { "skm", "application/x-koan" }
     , { "skm", "application/x-koan" }
     , { "skp", "application/x-koan" }
     , { "skp", "application/x-koan" }
     , { "skt", "application/x-koan" }
     , { "skt", "application/x-koan" }
     , { "smi", "application/smil" }
     , { "smi", "application/smil" }
     , { "smil", "application/smil" }
     , { "smil", "application/smil" }
     , { "snd", "audio/basic" }
     , { "snd", "audio/basic" }
     , { "so", "application/octet-stream" }
     , { "so", "application/octet-stream" }
     , { "spl", "application/x-futuresplash" }
     , { "spl", "application/x-futuresplash" }
     , { "src", "application/x-wais-source" }
     , { "src", "application/x-wais-source" }
     , { "stc", "application/vnd.sun.xml.calc.template" }
     , { "stc", "application/vnd.sun.xml.calc.template" }
     , { "std", "application/vnd.sun.xml.draw.template" }
     , { "std", "application/vnd.sun.xml.draw.template" }
     , { "sti", "application/vnd.sun.xml.impress.template" }
     , { "sti", "application/vnd.sun.xml.impress.template" }
     , { "stw", "application/vnd.sun.xml.writer.template" }
     , { "stw", "application/vnd.sun.xml.writer.template" }
     , { "sv4cpio", "application/x-sv4cpio" }
     , { "sv4cpio", "application/x-sv4cpio" }
     , { "sv4crc", "application/x-sv4crc" }
     , { "sv4crc", "application/x-sv4crc" }
     , { "swf", "application/x-shockwave-flash" }
     , { "swf", "application/x-shockwave-flash" }
     , { "sxc", "application/vnd.sun.xml.calc" }
     , { "sxc", "application/vnd.sun.xml.calc" }
     , { "sxd", "application/vnd.sun.xml.draw" }
     , { "sxd", "application/vnd.sun.xml.draw" }
     , { "sxg", "application/vnd.sun.xml.writer.global" }
     , { "sxg", "application/vnd.sun.xml.writer.global" }
     , { "sxi", "application/vnd.sun.xml.impress" }
     , { "sxi", "application/vnd.sun.xml.impress" }
     , { "sxm", "application/vnd.sun.xml.math" }
     , { "sxm", "application/vnd.sun.xml.math" }
     , { "sxw", "application/vnd.sun.xml.writer" }
     , { "sxw", "application/vnd.sun.xml.writer" }
     , { "t", "application/x-troff" }
     , { "t", "application/x-troff" }
     , { "tar", "application/x-tar" }
     , { "tar", "application/x-tar" }
     , { "tcl", "application/x-tcl" }
     , { "tcl", "application/x-tcl" }
     , { "tex", "application/x-tex" }
     , { "tex", "application/x-tex" }
     , { "texi", "application/x-texinfo" }
     , { "texi", "application/x-texinfo" }
     , { "texinfo", "application/x-texinfo" }
     , { "texinfo", "application/x-texinfo" }
     , { "tgz", "application/x-gzip" }
     , { "tgz", "application/x-gzip" }
     , { "tif", "image/tiff" }
     , { "tif", "image/tiff" }
     , { "tiff", "image/tiff" }
     , { "tiff", "image/tiff" }
     , { "torrent", "application/x-bittorrent" }
     , { "torrent", "application/x-bittorrent" }
     , { "tr", "application/x-troff" }
     , { "tr", "application/x-troff" }
     , { "tsv", "text/tab-separated-values" }
     , { "tsv", "text/tab-separated-values" }
     , { "txt", "text/plain" }
     , { "txt", "text/plain" }
     , { "ustar", "application/x-ustar" }
     , { "ustar", "application/x-ustar" }
     , { "vcd", "application/x-cdlink" }
     , { "vcd", "application/x-cdlink" }
     , { "vrml", "model/vrml" }
     , { "vrml", "model/vrml" }
     , { "wav", "audio/x-wav" }
     , { "wav", "audio/x-wav" }
     , { "wbmp", "image/vnd.wap.wbmp" }
     , { "wbmp", "image/vnd.wap.wbmp" }
     , { "wbxml", "application/vnd.wap.wbxml" }
     , { "wbxml", "application/vnd.wap.wbxml" }
     , { "wml", "text/vnd.wap.wml" }
     , { "wml", "text/vnd.wap.wml" }
     , { "wmlc", "application/vnd.wap.wmlc" }
     , { "wmlc", "application/vnd.wap.wmlc" }
     , { "wmls", "text/vnd.wap.wmlscript" }
     , { "wmls", "text/vnd.wap.wmlscript" }
     , { "wmlsc", "application/vnd.wap.wmlscriptc" }
     , { "wmlsc", "application/vnd.wap.wmlscriptc" }
     , { "wrl", "model/vrml" }
     , { "wrl", "model/vrml" }
     , { "xbm", "image/x-xbitmap" }
     , { "xbm", "image/x-xbitmap" }
     , { "xht", "application/xhtml+xml" }
     , { "xht", "application/xhtml+xml" }
     , { "xhtml", "application/xhtml+xml" }
     , { "xhtml", "application/xhtml+xml" }
     , { "xls", "application/vnd.ms-excel" }
     , { "xls", "application/vnd.ms-excel" }
     , { "xml", "text/xml" }
     , { "xml", "text/xml" }
     , { "xpm", "image/x-xpixmap" }
     , { "xpm", "image/x-xpixmap" }
     , { "xsl", "text/xml" }
     , { "xsl", "text/xml" }
     , { "xwd", "image/x-xwindowdump" }
     , { "xwd", "image/x-xwindowdump" }
     , { "xyz", "chemical/x-xyz" }
     , { "xyz", "chemical/x-xyz" }
     , { "zip", "application/zip" }
     , { "zip", "application/zip" }
    };
    };
 
 
  /**
  /**
   * The MIME types above are put into this Hashtable for faster lookup.
   * The MIME types above are put into this Hashtable for faster lookup.
   */
   */
  private Hashtable<String, String> mime_types
  private Hashtable<String, String> mime_types
    = new Hashtable<String, String>(150);
    = new Hashtable<String, String>(150);
 
 
  /**
  /**
   * Create a new <code>MimeTypeMapper</code> object.
   * Create a new <code>MimeTypeMapper</code> object.
   */
   */
  public MimeTypeMapper()
  public MimeTypeMapper()
  {
  {
    for (int i = 0; i < mime_strings.length; i++)
    for (int i = 0; i < mime_strings.length; i++)
      mime_types.put(mime_strings[i][0], mime_strings[i][1]);
      mime_types.put(mime_strings[i][0], mime_strings[i][1]);
 
 
    // Now read from the system mime database, if it exists.  Entries found
    // Now read from the system mime database, if it exists.  Entries found
    // here override our internal ones.
    // here override our internal ones.
    try
    try
      {
      {
        // On Linux this usually means /etc/mime.types.
        // On Linux this usually means /etc/mime.types.
        String file
        String file
          = SystemProperties.getProperty("gnu.classpath.mime.types.file");
          = SystemProperties.getProperty("gnu.classpath.mime.types.file");
        if (file != null)
        if (file != null)
          fillFromFile(mime_types, file);
          fillFromFile(mime_types, file);
      }
      }
    catch (IOException ignore)
    catch (IOException ignore)
      {
      {
      }
      }
  }
  }
 
 
  public static void fillFromFile (Map<String, String> table, String fname)
  public static void fillFromFile (Map<String, String> table, String fname)
    throws IOException
    throws IOException
  {
  {
    LineNumberReader reader =
    LineNumberReader reader =
      new LineNumberReader (new FileReader (fname));
      new LineNumberReader (new FileReader (fname));
 
 
    while (reader.ready ())
    while (reader.ready ())
      {
      {
        StringTokenizer tokenizer =
        StringTokenizer tokenizer =
          new StringTokenizer (reader.readLine ());
          new StringTokenizer (reader.readLine ());
 
 
        try
        try
          {
          {
            String t = tokenizer.nextToken ();
            String t = tokenizer.nextToken ();
 
 
            if (! t.startsWith ("#"))
            if (! t.startsWith ("#"))
              {
              {
                while (true)
                while (true)
                  {
                  {
                    // Read the next extension
                    // Read the next extension
                    String e = tokenizer.nextToken ();
                    String e = tokenizer.nextToken ();
                    if ((e != null) && (! e.startsWith ("#")))
                    if ((e != null) && (! e.startsWith ("#")))
                      table.put (e, t);
                      table.put (e, t);
                    else
                    else
                      break;
                      break;
                  }
                  }
              }
              }
          }
          }
        catch (NoSuchElementException ex)
        catch (NoSuchElementException ex)
          {
          {
            // Do nothing.
            // Do nothing.
          }
          }
      }
      }
  }
  }
 
 
  /**
  /**
   * The method returns the MIME type of the filename passed as an argument.
   * The method returns the MIME type of the filename passed as an argument.
   * The value returned is based on the extension of the filename.  The
   * The value returned is based on the extension of the filename.  The
   * default content type returned if this method cannot determine the
   * default content type returned if this method cannot determine the
   * actual content type is "application/octet-stream"
   * actual content type is "application/octet-stream"
   *
   *
   * @param filename The name of the file to return the MIME type for
   * @param filename The name of the file to return the MIME type for
   *
   *
   * @return The MIME type
   * @return The MIME type
   */
   */
  public String getContentTypeFor(String filename)
  public String getContentTypeFor(String filename)
  {
  {
    int index = filename.lastIndexOf(".");
    int index = filename.lastIndexOf(".");
    if (index != -1)
    if (index != -1)
      {
      {
        if (index == filename.length())
        if (index == filename.length())
          return "application/octet-stream";
          return "application/octet-stream";
        else
        else
          filename = filename.substring(index + 1);
          filename = filename.substring(index + 1);
      }
      }
 
 
    String type = (String) mime_types.get(filename);
    String type = (String) mime_types.get(filename);
    if (type == null)
    if (type == null)
      return "application/octet-stream";
      return "application/octet-stream";
    else
    else
      return type;
      return type;
  }
  }
 
 
  /**
  /**
   * Run this class as a program to create a new mime_strings table.
   * Run this class as a program to create a new mime_strings table.
   */
   */
  public static void main(String[] args) throws IOException
  public static void main(String[] args) throws IOException
  {
  {
    TreeMap<String, String> map = new TreeMap<String, String>();
    TreeMap<String, String> map = new TreeMap<String, String>();
    // It is fine to hard-code the name here.  This is only ever
    // It is fine to hard-code the name here.  This is only ever
    // used by maintainers, who can hack it if they need to re-run
    // used by maintainers, who can hack it if they need to re-run
    // it.
    // it.
    fillFromFile(map, "/etc/mime.types");
    fillFromFile(map, "/etc/mime.types");
    Iterator<String> it = map.keySet().iterator();
    Iterator<String> it = map.keySet().iterator();
    boolean first = true;
    boolean first = true;
    while (it.hasNext())
    while (it.hasNext())
      {
      {
        String key = it.next();
        String key = it.next();
        String value = map.get(key);
        String value = map.get(key);
        // Put the "," first since it is easier to make correct syntax this way.
        // Put the "," first since it is easier to make correct syntax this way.
        System.out.println("      " + (first ? "  " : ", ")
        System.out.println("      " + (first ? "  " : ", ")
                           + "{ \"" + key + "\", \"" + value + "\" }");
                           + "{ \"" + key + "\", \"" + value + "\" }");
        first = false;
        first = false;
      }
      }
  }
  }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.