Reputation:
Can ByteArrayOutputStream
be stored into some other container like say HashMap?
If not how do I merge all my streams and then zip archive by entries into 1 file.
public class CFr {
private static HashMap<String, Object> fileEntries;
public static void setFileEntries(String fileNameEntry, Object fileEntry) {
CFr.fileEntries.put(fileNameEntry, fileEntry);
}
}
public void addDocx(CDb cd) {
CFr.setFileEntries((String)entryName, (ByteArrayOutputStream)bos);
}
And I get NullPointer on that setFileEntries
line. Doesn't seem right, I was just assuming it is possible.
Upvotes: 0
Views: 26
Reputation: 76424
Yes, it can be stored, but you will need to initialize your HashMap
for that purpose. In your case this
private static HashMap<String, Object> fileEntries;
is never initialized. You will need to do something like this:
private static HashMap<String, Object> fileEntries = new HashMap<String, Object>();
instead. This will fix your current issue.
Upvotes: 1