<commit_before>import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;

/*******************************************************************************
 * Copyright (c) 2012 <NAME>. 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:
 *     <NAME> - initial API and implementation
 *******************************************************************************/

public class TryWithResources {

    public static void main(String[] args) throws IOException {
        File file = createTmpFile();

        // 15 lines to write one line into file
        oldWayWrite(file);

        // 19 lines to read file
        oldWayRead(file);

        // 5 lines to write one line into file
        java7Write(file);

        // 8 lines to read file
        java7Read(file);

        // 1 line to read file (use API!)
        System.out.println(Files.readAllLines(file.toPath(), Charset.defaultCharset()));

        // 1 line to dump file to stderr (use API!)
        Files.copy(file.toPath(), System.err);
        System.err.println();

        // example how multiple resources can be used
        multipleClose(file, createTmpFile());
        multipleClose2(file, createTmpFile());
    }<commit_msg>Moved file header<commit_after>/*******************************************************************************
 * Copyright (c) 2012 <NAME>. 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:
 *     <NAME> - initial API and implementation
 *******************************************************************************/

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;

public class TryWithResources {

    public static void main(String[] args) throws IOException {
        File file = createTmpFile();

        // 15 lines to write one line into file
        oldWayWrite(file);

        // 19 lines to read file
        oldWayRead(file);

        // 5 lines to write one line into file
        java7Write(file);

        // 8 lines to read file
        java7Read(file);

        // 1 line to read file (use API!)
        System.out.println(Files.readAllLines(file.toPath(), Charset.defaultCharset()));

        // 1 line to dump file to stderr (use API!)
        Files.copy(file.toPath(), System.err);
        System.err.println();

        // example how multiple resources can be used
        multipleClose(file, createTmpFile());
        multipleClose2(file, createTmpFile());
    }
{'fraction_non_alphanumeric': 0.1927554980595084, 'fraction_numerical': 0.012289780077619664, 'mean_word_length': 3.174089068825911, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '5077925', 'n_tokens_mistral': 835, 'n_tokens_neox': 769, 'n_words': 261}