96 if (node instanceof IIOMetadataNode) {
97 IIOMetadataNode iioNode = (IIOMetadataNode) node;
98 try {
99 data = (byte []) iioNode.getUserObject();
100 } catch (Exception e) {
101 IIOInvalidTreeException newGuy =
102 new IIOInvalidTreeException
103 ("Can't get User Object", node);
104 newGuy.initCause(e);
105 throw newGuy;
106 }
107 } else {
108 throw new IIOInvalidTreeException
109 ("Node must have User Object", node);
110 }
111 }
112
113 /**
114 * Deep copy of data array.
115 */
116 protected Object clone() {
117 MarkerSegment newGuy = null;
118 try {
119 newGuy = (MarkerSegment) super.clone();
120 } catch (CloneNotSupportedException e) {} // won't happen
121 if (this.data != null) {
122 newGuy.data = data.clone();
123 }
124 return newGuy;
125 }
126
127 /**
128 * We have determined that we don't know the type, so load
129 * the data using the length parameter.
130 */
131 void loadData(JPEGBuffer buffer) throws IOException {
132 data = new byte[length];
133 buffer.readData(data);
134 }
135
136 IIOMetadataNode getNativeNode() {
|
96 if (node instanceof IIOMetadataNode) {
97 IIOMetadataNode iioNode = (IIOMetadataNode) node;
98 try {
99 data = (byte []) iioNode.getUserObject();
100 } catch (Exception e) {
101 IIOInvalidTreeException newGuy =
102 new IIOInvalidTreeException
103 ("Can't get User Object", node);
104 newGuy.initCause(e);
105 throw newGuy;
106 }
107 } else {
108 throw new IIOInvalidTreeException
109 ("Node must have User Object", node);
110 }
111 }
112
113 /**
114 * Deep copy of data array.
115 */
116 protected MarkerSegment clone() {
117 MarkerSegment newGuy = null;
118 try {
119 newGuy = (MarkerSegment) super.clone();
120 } catch (CloneNotSupportedException e) {} // won't happen
121 if (this.data != null) {
122 newGuy.data = data.clone();
123 }
124 return newGuy;
125 }
126
127 /**
128 * We have determined that we don't know the type, so load
129 * the data using the length parameter.
130 */
131 void loadData(JPEGBuffer buffer) throws IOException {
132 data = new byte[length];
133 buffer.readData(data);
134 }
135
136 IIOMetadataNode getNativeNode() {
|