|
Lines 34-59
public abstract class ComplexTypeCodeWriter implements TypeCodeWriter
Link Here
|
| 34 |
public void writeTypeCode(TypeCode typeCode, CDROutputStream out, |
34 |
public void writeTypeCode(TypeCode typeCode, CDROutputStream out, |
| 35 |
Map recursiveTCMap, Map repeatedTCMap) |
35 |
Map recursiveTCMap, Map repeatedTCMap) |
| 36 |
{ |
36 |
{ |
| 37 |
if (out.isIndirectionEnabled() && repeatedTCMap.containsKey(typeCode)) |
37 |
try |
| 38 |
{ |
38 |
{ |
| 39 |
writeIndirectionMarker(out, typeCode, repeatedTCMap); |
39 |
tryWriteTypeCode(typeCode, out, recursiveTCMap, repeatedTCMap); |
| 40 |
} |
40 |
} |
| 41 |
else |
41 |
catch (BadKind e) |
| 42 |
{ |
42 |
{ |
| 43 |
try |
43 |
assert false; |
| 44 |
{ |
44 |
throw new RuntimeException(e); |
| 45 |
tryWriteTypeCode(typeCode, out, recursiveTCMap, repeatedTCMap); |
45 |
} |
| 46 |
} |
46 |
catch (Bounds e) |
| 47 |
catch (BadKind e) |
47 |
{ |
| 48 |
{ |
48 |
assert false; |
| 49 |
assert false; |
49 |
throw new RuntimeException(e); |
| 50 |
throw new RuntimeException(e); |
|
|
| 51 |
} |
| 52 |
catch (Bounds e) |
| 53 |
{ |
| 54 |
assert false; |
| 55 |
throw new RuntimeException(e); |
| 56 |
} |
| 57 |
} |
50 |
} |
| 58 |
} |
51 |
} |
| 59 |
|
52 |
|
|
Lines 82-96
public abstract class ComplexTypeCodeWriter implements TypeCodeWriter
Link Here
|
| 82 |
} |
75 |
} |
| 83 |
|
76 |
|
| 84 |
protected abstract void doWriteTypeCodeParameters(TypeCode typeCode, CDROutputStream out, Map recursiveTCMap, Map repeatedTCMap) throws BadKind, Bounds; |
77 |
protected abstract void doWriteTypeCodeParameters(TypeCode typeCode, CDROutputStream out, Map recursiveTCMap, Map repeatedTCMap) throws BadKind, Bounds; |
| 85 |
|
|
|
| 86 |
private final void writeIndirectionMarker(final CDROutputStream out, |
| 87 |
final Object key, |
| 88 |
final Map indirectionTCMap) |
| 89 |
{ |
| 90 |
out.write_long( -1 ); // recursion marker |
| 91 |
int negative_offset = |
| 92 |
((Integer) indirectionTCMap.get(key)).intValue() - out.get_pos() - 4; |
| 93 |
|
| 94 |
out.write_long( negative_offset ); |
| 95 |
} |
| 96 |
} |
78 |
} |