< prev index next >

src/jdk.jdwp.agent/share/native/libjdwp/outStream.c

Print this page




 318         if ( new_length == length ) {
 319             (void)outStream_writeInt(stream, length);
 320             error = writeBytes(stream, (jbyte *)string, length);
 321         } else {
 322             char *new_string;
 323 
 324             new_string = jvmtiAllocate(new_length+1);
 325             utf8mToUtf8s((jbyte*)string, length, (jbyte*)new_string, new_length);
 326             (void)outStream_writeInt(stream, new_length);
 327             error = writeBytes(stream, (jbyte *)new_string, new_length);
 328             jvmtiDeallocate(new_string);
 329         }
 330     }
 331     return error;
 332 }
 333 
 334 jdwpError
 335 outStream_writeValue(JNIEnv *env, PacketOutputStream *out,
 336                      jbyte typeKey, jvalue value)
 337 {
 338     if (typeKey == JDWP_TAG(OBJECT)) {
 339         (void)outStream_writeByte(out, specificTypeKey(env, value.l));
 340     } else {
 341         (void)outStream_writeByte(out, typeKey);
 342     }
 343     if (isObjectTag(typeKey)) {
 344         (void)outStream_writeObjectRef(env, out, value.l);
 345     } else {
 346         switch (typeKey) {
 347             case JDWP_TAG(BYTE):
 348                 return outStream_writeByte(out, value.b);
 349 
 350             case JDWP_TAG(CHAR):
 351                 return outStream_writeChar(out, value.c);
 352 
 353             case JDWP_TAG(FLOAT):
 354                 return outStream_writeFloat(out, value.f);
 355 
 356             case JDWP_TAG(DOUBLE):
 357                 return outStream_writeDouble(out, value.d);
 358 




 318         if ( new_length == length ) {
 319             (void)outStream_writeInt(stream, length);
 320             error = writeBytes(stream, (jbyte *)string, length);
 321         } else {
 322             char *new_string;
 323 
 324             new_string = jvmtiAllocate(new_length+1);
 325             utf8mToUtf8s((jbyte*)string, length, (jbyte*)new_string, new_length);
 326             (void)outStream_writeInt(stream, new_length);
 327             error = writeBytes(stream, (jbyte *)new_string, new_length);
 328             jvmtiDeallocate(new_string);
 329         }
 330     }
 331     return error;
 332 }
 333 
 334 jdwpError
 335 outStream_writeValue(JNIEnv *env, PacketOutputStream *out,
 336                      jbyte typeKey, jvalue value)
 337 {
 338     if (typeKey == JDWP_TAG(OBJECT) || typeKey == JDWP_TAG(INLINE_OBJECT)) {
 339         (void)outStream_writeByte(out, specificTypeKey(env, value.l));
 340     } else {
 341         (void)outStream_writeByte(out, typeKey);
 342     }
 343     if (isObjectTag(typeKey)) {
 344         (void)outStream_writeObjectRef(env, out, value.l);
 345     } else {
 346         switch (typeKey) {
 347             case JDWP_TAG(BYTE):
 348                 return outStream_writeByte(out, value.b);
 349 
 350             case JDWP_TAG(CHAR):
 351                 return outStream_writeChar(out, value.c);
 352 
 353             case JDWP_TAG(FLOAT):
 354                 return outStream_writeFloat(out, value.f);
 355 
 356             case JDWP_TAG(DOUBLE):
 357                 return outStream_writeDouble(out, value.d);
 358 


< prev index next >