<commit_before>package controllers;

import java.io.*;
import java.util.*;
import java.util.zip.*;

import play.*;
import play.mvc.Controller;

import models.Template;

import org.xml.sax.InputSource;
import Support.*;

public class ZipFactory extends Controller{
	static final int BUFFER = 2048;
	static final String ENCODING = "UTF-8";

	// generates a zip-file as byte stream
	public static byte[] Generate(
			ArrayList<NamedString> named_strings, String filename, 
			String content_type, boolean test_mode) throws IOException 
	{
		ByteArrayOutputStream dest = new ByteArrayOutputStream();
		ZipOutputStream out = new ZipOutputStream(
				new BufferedOutputStream(dest));

		// run over all strings and add them in binary
		for (int i = 0; i < named_strings.size(); i++) 
		{
			ZipEntry entry = new ZipEntry(named_strings.get(i).FileName);
			out.putNextEntry(entry);

			InputStream origin = new ByteArrayInputStream(
					named_strings.get(i).Content
					.getBytes(ENCODING));
			byte data[] = new byte[BUFFER];
			
			int count;
			while ((count = origin.read(data, 0, BUFFER)) != -1) 
			{<commit_msg>did some changed in zip-factory<commit_after>package controllers;

import java.io.*;
import java.util.*;
import java.util.zip.*;

import play.*;
import play.mvc.Controller;

import models.Template;

import org.xml.sax.InputSource;
import Support.*;

public class ZipFactory extends Controller{
	static final int BUFFER = 2048;
	static final String ENCODING = "UTF-8";

	// generates a zip-file as byte stream
	public static byte[] Generate(
			ArrayList<NamedString> named_strings, String filename, 
			String content_type, boolean test_mode) throws IOException 
	{
		ByteArrayOutputStream dest = new ByteArrayOutputStream();
		ZipOutputStream out = new ZipOutputStream(
				new BufferedOutputStream(dest));

		// run over all strings and add them in binary
		for (int i = 0; i < named_strings.size(); i++) 
		{
			ZipEntry entry = new ZipEntry(named_strings.get(i).filename);
			out.putNextEntry(entry);

			InputStream origin = new ByteArrayInputStream(
					named_strings.get(i).content
					.getBytes(ENCODING));
			byte data[] = new byte[BUFFER];
			
			int count;
			while ((count = origin.read(data, 0, BUFFER)) != -1) 
			{
{'fraction_non_alphanumeric': 0.10828877005347594, 'fraction_numerical': 0.0071301247771836, 'mean_word_length': 4.056306306306307, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4416485', 'n_tokens_mistral': 763, 'n_tokens_neox': 650, 'n_words': 208}