<commit_before>/*******************************************************************************
 * Copyright (c) 2004,2008 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.util;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Collection of file utility.
 * 
 */
public class FileUtil
{

	/**
	 * The default prefix for creating temporarily file.
	 */
	private static String DEFAULT_PREFIX = "Res"; //$NON-NLS-1$

	/**
	 * The Log object that <code>FileUtil</code> uses to log the error, debug,
	 * information messages.
	 */
	protected static Logger logger = Logger.getLogger( FileUtil.class.getName() );

	/**
	 * The <code>HashMap</code> object that stores image type/file extension
	 * mapping.
	 */
	private static HashMap fileExtension = new HashMap( );
	private static HashMap mimeType = new HashMap( );

	static
	{
		// initialize fileExtension
		fileExtension.put( "image/bmp", ".bmp" ); //$NON-NLS-1$ //$NON-NLS-2$
		fileExtension.put( "image/gif", ".gif" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/jpeg", ".jpg" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/pcx", ".pcx" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/png", ".png" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/x-png", ".png" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/tif", ".tif" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/svg+xml", ".svg" );  //$NON-NLS-1$//$NON-NLS-2$
		
		// initialize mimeType
		mimeType.put( ".bmp", "image/bmp" ); //$NON-NLS-1$ //$NON-NLS-2$
		mimeType.put( ".gif", "image/gif" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".jpg", "image/jpeg" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".pcx", "image/pcx" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".png", "image/png" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".png", "image/x-png" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".tif", "image/tif" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".svg", "image/svg+xml" );  //$NON-NLS-1$//$NON-NLS-2$
	}

	/**<commit_msg>33575 - Fail to show ico image from resource folder in IE<commit_after>/*******************************************************************************
 * Copyright (c) 2004,2008 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.util;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Collection of file utility.
 * 
 */
public class FileUtil
{

	/**
	 * The default prefix for creating temporarily file.
	 */
	private static String DEFAULT_PREFIX = "Res"; //$NON-NLS-1$

	/**
	 * The Log object that <code>FileUtil</code> uses to log the error, debug,
	 * information messages.
	 */
	protected static Logger logger = Logger.getLogger( FileUtil.class.getName() );

	/**
	 * The <code>HashMap</code> object that stores image type/file extension
	 * mapping.
	 */
	private static HashMap fileExtension = new HashMap( );
	private static HashMap mimeType = new HashMap( );

	static
	{
		// initialize fileExtension
		fileExtension.put( "image/bmp", ".bmp" ); //$NON-NLS-1$ //$NON-NLS-2$
		fileExtension.put( "image/gif", ".gif" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/jpeg", ".jpg" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/pcx", ".pcx" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/png", ".png" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/x-png", ".png" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/tif", ".tif" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/svg+xml", ".svg" );  //$NON-NLS-1$//$NON-NLS-2$
		fileExtension.put( "image/x-icon", ".ico" );//$NON-NLS-1$//$NON-NLS-2$
		
		// initialize mimeType
		mimeType.put( ".bmp", "image/bmp" ); //$NON-NLS-1$ //$NON-NLS-2$
		mimeType.put( ".gif", "image/gif" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".jpg", "image/jpeg" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".pcx", "image/pcx" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".png", "image/png" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".png", "image/x-png" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".tif", "image/tif" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".svg", "image/svg+xml" );  //$NON-NLS-1$//$NON-NLS-2$
		mimeType.put( ".ico", "image/x-icon" ); //$NON-NLS-1$//$NON-NLS-2$
	}

	/**
{'fraction_non_alphanumeric': 0.24569559228650137, 'fraction_numerical': 0.017045454545454544, 'mean_word_length': 3.574015748031496, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6039232', 'n_tokens_mistral': 2226, 'n_tokens_neox': 2092, 'n_words': 422}