Source Code Cross Referenced for EscherBlipRecord.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » ddf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » poi 3.0.2 beta2 » org.apache.poi.ddf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:         Licensed to the Apache Software Foundation (ASF) under one or more
003:         contributor license agreements.  See the NOTICE file distributed with
004:         this work for additional information regarding copyright ownership.
005:         The ASF licenses this file to You under the Apache License, Version 2.0
006:         (the "License"); you may not use this file except in compliance with
007:         the License.  You may obtain a copy of the License at
008:
009:         http://www.apache.org/licenses/LICENSE-2.0
010:
011:         Unless required by applicable law or agreed to in writing, software
012:         distributed under the License is distributed on an "AS IS" BASIS,
013:         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         See the License for the specific language governing permissions and
015:         limitations under the License.
016:         ==================================================================== */
017:
018:        package org.apache.poi.ddf;
019:
020:        import org.apache.poi.util.LittleEndian;
021:        import org.apache.poi.util.HexDump;
022:
023:        import java.io.ByteArrayOutputStream;
024:
025:        /**
026:         * @author Glen Stampoultzis
027:         * @version $Id: EscherBlipRecord.java 569827 2007-08-26 15:26:29Z yegor $
028:         */
029:        public class EscherBlipRecord extends EscherRecord {
030:            public static final short RECORD_ID_START = (short) 0xF018;
031:            public static final short RECORD_ID_END = (short) 0xF117;
032:            public static final String RECORD_DESCRIPTION = "msofbtBlip";
033:
034:            private static final int HEADER_SIZE = 8;
035:
036:            protected byte[] field_pictureData;
037:
038:            public EscherBlipRecord() {
039:            }
040:
041:            /**
042:             * This method deserializes the record from a byte array.
043:             *
044:             * @param data          The byte array containing the escher record information
045:             * @param offset        The starting offset into <code>data</code>.
046:             * @param recordFactory May be null since this is not a container record.
047:             * @return The number of bytes read from the byte array.
048:             */
049:            public int fillFields(byte[] data, int offset,
050:                    EscherRecordFactory recordFactory) {
051:                int bytesAfterHeader = readHeader(data, offset);
052:                int pos = offset + HEADER_SIZE;
053:
054:                field_pictureData = new byte[bytesAfterHeader];
055:                System.arraycopy(data, pos, field_pictureData, 0,
056:                        bytesAfterHeader);
057:
058:                return bytesAfterHeader + 8;
059:            }
060:
061:            /**
062:             * Serializes the record to an existing byte array.
063:             *
064:             * @param offset    the offset within the byte array
065:             * @param data      the data array to serialize to
066:             * @param listener  a listener for begin and end serialization events.  This
067:             *                  is useful because the serialization is
068:             *                  hierarchical/recursive and sometimes you need to be able
069:             *                  break into that.
070:             * @return the number of bytes written.
071:             */
072:            public int serialize(int offset, byte[] data,
073:                    EscherSerializationListener listener) {
074:                listener.beforeRecordSerialize(offset, getRecordId(), this );
075:
076:                LittleEndian.putShort(data, offset, getOptions());
077:                LittleEndian.putShort(data, offset + 2, getRecordId());
078:
079:                System.arraycopy(field_pictureData, 0, data, offset + 4,
080:                        field_pictureData.length);
081:
082:                listener.afterRecordSerialize(offset + 4
083:                        + field_pictureData.length, getRecordId(),
084:                        field_pictureData.length + 4, this );
085:                return field_pictureData.length + 4;
086:            }
087:
088:            /**
089:             * Returns the number of bytes that are required to serialize this record.
090:             *
091:             * @return Number of bytes
092:             */
093:            public int getRecordSize() {
094:                return field_pictureData.length + HEADER_SIZE;
095:            }
096:
097:            /**
098:             * The short name for this record
099:             */
100:            public String getRecordName() {
101:                return "Blip";
102:            }
103:
104:            public byte[] getPicturedata() {
105:                return field_pictureData;
106:            }
107:
108:            public void setPictureData(byte[] pictureData) {
109:                field_pictureData = pictureData;
110:            }
111:
112:            public String toString() {
113:                String nl = System.getProperty("line.separator");
114:
115:                String extraData;
116:                ByteArrayOutputStream b = new ByteArrayOutputStream();
117:                try {
118:                    HexDump.dump(this .field_pictureData, 0, b, 0);
119:                    extraData = b.toString();
120:                } catch (Exception e) {
121:                    extraData = e.toString();
122:                }
123:                return getClass().getName() + ":" + nl + "  RecordId: 0x"
124:                        + HexDump.toHex(getRecordId()) + nl + "  Options: 0x"
125:                        + HexDump.toHex(getOptions()) + nl + "  Extra Data:"
126:                        + nl + extraData;
127:
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.