What do you think about the following solution. We split into two separate execution paths, diverging through (copy), so we even save some possibly unnecessary instantiation. Additionally we change the catch of the overall Exception to the only occuring IOException

```
public InputStream constructTable(InputStream source, boolean copy){
		freq = new int[TABLESIZE];
		try {
			if (copy == true) {
				File file = File.createTempFile("huf", "tmp");
				file.deleteOnExit();
				FileOutputStream fos = new FileOutputStream(file);
				
				while (source.available() != 0) {
					int c = source.read();
					freq[c]++;
					fos.write(c);
				}
				
				source.close();
				fos.close();
				return new FileInputStream(file);
			} else {
				while (source.available() != 0) {
					int c = source.read();
					freq[c]++;
				}
				source.close();
				return null;
			}
		} catch (IOException ex) {
			ExHandler.handle(ex);
			return null;
		}
	}
```