43 |
import gnu.classpath.jdwp.exception.InvalidFieldException; |
import gnu.classpath.jdwp.exception.InvalidFieldException; |
44 |
import gnu.classpath.jdwp.exception.JdwpException; |
import gnu.classpath.jdwp.exception.JdwpException; |
45 |
import gnu.classpath.jdwp.exception.JdwpInternalErrorException; |
import gnu.classpath.jdwp.exception.JdwpInternalErrorException; |
46 |
|
import gnu.classpath.jdwp.exception.NotImplementedException; |
47 |
import gnu.classpath.jdwp.id.ObjectId; |
import gnu.classpath.jdwp.id.ObjectId; |
48 |
|
|
49 |
import java.io.DataOutputStream; |
import java.io.DataOutputStream; |
66 |
* @throws InvalidFieldException |
* @throws InvalidFieldException |
67 |
*/ |
*/ |
68 |
public static void writeUntaggedValue(DataOutputStream os, Object obj) |
public static void writeUntaggedValue(DataOutputStream os, Object obj) |
69 |
throws InvalidFieldException, IOException |
throws JdwpException, IOException |
70 |
{ |
{ |
71 |
writeValue(os, obj, false); |
writeValue(os, obj, false); |
72 |
} |
} |
80 |
* @throws InvalidFieldException |
* @throws InvalidFieldException |
81 |
*/ |
*/ |
82 |
public static void writeTaggedValue(DataOutputStream os, Object obj) |
public static void writeTaggedValue(DataOutputStream os, Object obj) |
83 |
throws InvalidFieldException, IOException |
throws JdwpException, IOException |
84 |
{ |
{ |
85 |
writeValue(os, obj, true); |
writeValue(os, obj, true); |
86 |
} |
} |
97 |
*/ |
*/ |
98 |
private static void writeValue(DataOutputStream os, Object obj, |
private static void writeValue(DataOutputStream os, Object obj, |
99 |
boolean tagged) |
boolean tagged) |
100 |
throws IOException, InvalidFieldException |
throws IOException, JdwpException |
101 |
{ |
{ |
102 |
Class clazz = obj.getClass(); |
Class clazz = obj.getClass(); |
103 |
if (clazz.isPrimitive()) |
if (clazz.isPrimitive()) |
157 |
} |
} |
158 |
else |
else |
159 |
{ // This shouldn't be possible |
{ // This shouldn't be possible |
160 |
throw new InvalidFieldException("Field has invalid primitive!"); |
throw new JdwpInternalErrorException( |
161 |
|
"Field has invalid primitive!"); |
162 |
} |
} |
163 |
} |
} |
164 |
else |
else |
237 |
return new byte[0]; |
return new byte[0]; |
238 |
else |
else |
239 |
{ // This shouldn't be possible |
{ // This shouldn't be possible |
240 |
throw new InvalidFieldException("Field has invalid primitive!"); |
throw new JdwpInternalErrorException( |
241 |
|
"Field has invalid primitive!"); |
242 |
} |
} |
243 |
} |
} |
244 |
else |
else |
294 |
ObjectId oid = Jdwp.getIdManager().readId(bb); |
ObjectId oid = Jdwp.getIdManager().readId(bb); |
295 |
return oid.getObject(); |
return oid.getObject(); |
296 |
default: |
default: |
297 |
throw new JdwpInternalErrorException("Could not find TAG:" + tag); |
throw new NotImplementedException("Tag " + tag |
298 |
|
+ " is not implemented."); |
299 |
} |
} |
300 |
} |
} |
301 |
} |
} |