01: // FrameArrayAttribute.java
02: // $Id: FrameArrayAttribute.java,v 1.4 2000/08/16 21:37:55 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.resources.upgrade;
07:
08: import java.io.DataInputStream;
09: import java.io.DataOutputStream;
10: import java.io.IOException;
11:
12: import org.w3c.tools.resources.ResourceFrame;
13: import org.w3c.tools.resources.UnknownFrame;
14:
15: public class FrameArrayAttribute extends Attribute {
16:
17: public boolean checkValue(Object value) {
18: return value instanceof ResourceFrame[];
19: }
20:
21: public int getPickleLength(Object value) {
22: throw new RuntimeException("unused for upgrade");
23: }
24:
25: public void pickle(DataOutputStream out, Object obj)
26: throws IOException {
27: throw new RuntimeException("unused for upgrade");
28: }
29:
30: public Object unpickle(DataInputStream in) throws IOException {
31: int cnt = in.readInt();
32: if (cnt == 0)
33: return null;
34: ResourceFrame frames[] = new ResourceFrame[cnt];
35: for (int i = 0; i < cnt; i++) {
36: try {
37: frames[i] = (ResourceFrame) Upgrader.readResource(in);
38: } catch (UpgradeException ex) {
39: frames[i] = new UnknownFrame();
40: }
41: }
42: return frames;
43: }
44:
45: public FrameArrayAttribute(String name, ResourceFrame def[],
46: Integer flags) {
47: super(name, def, flags);
48: }
49:
50: }
|