Here you can find the source of getBytesFromArrayList(final ArrayList
Parameter | Description |
---|---|
fileList | TODO |
Parameter | Description |
---|---|
IOException | TODO |
public static byte[] getBytesFromArrayList(final ArrayList<File> fileList) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.util.ArrayList; public class Main { /**/* w ww. j a v a2 s . co m*/ * TODO * * @param fileList * TODO * @return TODO * @throws IOException * TODO */ public static byte[] getBytesFromArrayList(final ArrayList<File> fileList) throws IOException { // TODO besser arrayList<String>? byte[] yourBytes; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(fileList); yourBytes = bos.toByteArray(); } finally { try { if (out != null) { out.close(); } if (bos != null) { bos.close(); } } catch (IOException ex) { // ignore close exception } } return yourBytes; } }