01: /*
02: Copyright © 2007 Stefano Chizzolini. http://clown.stefanochizzolini.it
03:
04: Contributors:
05: * Stefano Chizzolini (original code developer, http://www.stefanochizzolini.it):
06: contributed code is Copyright © 2007 by Stefano Chizzolini.
07:
08: This file should be part of the source code distribution of "PDF Clown library"
09: (the Program): see the accompanying README files for more info.
10:
11: This Program is free software; you can redistribute it and/or modify it under
12: the terms of the GNU General Public License as published by the Free Software
13: Foundation; either version 2 of the License, or (at your option) any later version.
14:
15: This Program is distributed in the hope that it will be useful, but WITHOUT ANY
16: WARRANTY, either expressed or implied; without even the implied warranty of
17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
18:
19: You should have received a copy of the GNU General Public License along with this
20: Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
21:
22: Redistribution and use, with or without modification, are permitted provided that such
23: redistributions retain the above copyright notice, license and disclaimer, along with
24: this list of conditions.
25: */
26:
27: package it.stefanochizzolini.clown.documents.contents.objects;
28:
29: import it.stefanochizzolini.clown.bytes.IBuffer;
30: import it.stefanochizzolini.clown.util.NotImplementedException;
31:
32: import java.util.Arrays;
33: import java.util.List;
34:
35: /**
36: Inline image object [PDF:1.6:4.8.6].
37:
38: @author Stefano Chizzolini
39: @version 0.0.5
40: @since 0.0.4
41: */
42: public final class InlineImage extends GraphicsObject {
43: // <class>
44: // <static>
45: // <fields>
46: public static final String BeginOperator = BeginInlineImage.Operator;
47: public static final String EndOperator = EndInlineImage.Operator;
48:
49: private static final String DataOperator = "ID";
50:
51: // </fields>
52: // </static>
53:
54: // <dynamic>
55: // <fields>
56: // </fields>
57:
58: // <constructors>
59: public InlineImage(InlineImageHeader header, InlineImageBody body) {
60: super (Arrays.asList(header, body));
61: }
62:
63: // </constructors>
64:
65: // <interface>
66: // <public>
67: public InlineImageBody getBody() {
68: return (InlineImageBody) getObjects().get(1);
69: }
70:
71: public InlineImageHeader getHeader() {
72: return (InlineImageHeader) getObjects().get(0);
73: }
74:
75: /**
76: @version 0.0.5
77: */
78: @Override
79: public void writeTo(IBuffer buffer) {
80: buffer.append(BeginOperator);
81: buffer.append("\n");
82:
83: getHeader().writeTo(buffer);
84:
85: buffer.append(DataOperator);
86: buffer.append("\n");
87:
88: getBody().writeTo(buffer);
89: buffer.append("\n"); // [FIX:0.0.4:3] Missed new-line symbol.
90:
91: buffer.append(EndOperator);
92: }
93: // </public>
94: // </interface>
95: // </dynamic>
96: // </class>
97: }
|