1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.psd;
18
19 import java.io.IOException;
20 import java.io.PrintWriter;
21 import java.io.StringWriter;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24
25 public class PsdImageContents {
26
27 private static final Logger LOGGER = Logger.getLogger(PsdImageContents.class.getName());
28
29 public final PsdHeaderInfo header;
30
31 public final int colorModeDataLength;
32 public final int imageResourcesLength;
33 public final int layerAndMaskDataLength;
34 public final int compression;
35
36 public PsdImageContents(final PsdHeaderInfo header,
37
38 final int colorModeDataLength, final int imageResourcesLength, final int layerAndMaskDataLength, final int compression) {
39 this.header = header;
40 this.colorModeDataLength = colorModeDataLength;
41 this.imageResourcesLength = imageResourcesLength;
42 this.layerAndMaskDataLength = layerAndMaskDataLength;
43 this.compression = compression;
44 }
45
46 public void dump() {
47 try (StringWriter sw = new StringWriter();
48 PrintWriter pw = new PrintWriter(sw)) {
49 dump(pw);
50 pw.flush();
51 sw.flush();
52 LOGGER.fine(sw.toString());
53 } catch (final IOException e) {
54 LOGGER.log(Level.SEVERE, e.getMessage(), e);
55 }
56 }
57
58 public void dump(final PrintWriter pw) {
59 pw.println("");
60 pw.println("ImageContents");
61 pw.println("Compression: " + compression + " (" + Integer.toHexString(compression) + ")");
62 pw.println("ColorModeDataLength: " + colorModeDataLength + " (" + Integer.toHexString(colorModeDataLength) + ")");
63 pw.println("ImageResourcesLength: " + imageResourcesLength + " (" + Integer.toHexString(imageResourcesLength) + ")");
64 pw.println("LayerAndMaskDataLength: " + layerAndMaskDataLength + " (" + Integer.toHexString(layerAndMaskDataLength) + ")");
65
66
67
68
69
70 pw.println("");
71 pw.flush();
72
73 }
74
75 }