Zipping a byte[] from a txt file
<p>I need to read a txt file, convert it from UTF8 to ISO8859-1 and store the textfile into a zip.</p>

<p>This is what i got so far:</p>

<pre><code>Charset utf8charset = Charset.forName("UTF-8");
Charset iso88591charset = Charset.forName("ISO-8859-1");

File file_in = new File("Input/file1.txt");
File file_out = new File("Output/file_out.txt");

try {
    FileInputStream fis = new FileInputStream(file_in);
    BufferedInputStream bis = new BufferedInputStream(fis);
    byte fileContent[] = new byte[(int)file_in.length()];

    bis.read(fileContent);

    ByteBuffer bb = ByteBuffer.wrap(fileContent);
    CharBuffer data = utf8charset.decode(bb);
    ByteBuffer outputBuffer = iso88591charset.encode(data);
    byte outputData[] = outputBuffer.array();

    FileOutputStream fos = new FileOutputStream(file_out);
    BufferedOutputStream bos = new BufferedOutputStream(fos);
    bos.write(outputData);
    bos.close();

} catch ...
</code></pre>

<p>Do I have to create the txt file, read it again and zip it den with ZipOutputStream?
Or is there a way to use the byte[] of the txtfile to create the zip??</p>
