SipMessage.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.9
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. package org.doubango.tinyWRAP;
  9. public class SipMessage {
  10. private long swigCPtr;
  11. protected boolean swigCMemOwn;
  12. protected SipMessage(long cPtr, boolean cMemoryOwn) {
  13. swigCMemOwn = cMemoryOwn;
  14. swigCPtr = cPtr;
  15. }
  16. protected static long getCPtr(SipMessage obj) {
  17. return (obj == null) ? 0 : obj.swigCPtr;
  18. }
  19. protected void finalize() {
  20. delete();
  21. }
  22. public synchronized void delete() {
  23. if (swigCPtr != 0) {
  24. if (swigCMemOwn) {
  25. swigCMemOwn = false;
  26. tinyWRAPJNI.delete_SipMessage(swigCPtr);
  27. }
  28. swigCPtr = 0;
  29. }
  30. }
  31. public byte[] getSipContent() {
  32. final int clen = (int)this.getSipContentLength();
  33. if(clen>0){
  34. final java.nio.ByteBuffer buffer = java.nio.ByteBuffer.allocateDirect(clen);
  35. final int read = (int)this.getSipContent(buffer, clen);
  36. final byte[] bytes = new byte[read];
  37. buffer.get(bytes, 0, read);
  38. return bytes;
  39. }
  40. return null;
  41. }
  42. public SipMessage() {
  43. this(tinyWRAPJNI.new_SipMessage(), true);
  44. }
  45. public boolean isResponse() {
  46. return tinyWRAPJNI.SipMessage_isResponse(swigCPtr, this);
  47. }
  48. public tsip_request_type_t getRequestType() {
  49. return tsip_request_type_t.swigToEnum(tinyWRAPJNI.SipMessage_getRequestType(swigCPtr, this));
  50. }
  51. public short getResponseCode() {
  52. return tinyWRAPJNI.SipMessage_getResponseCode(swigCPtr, this);
  53. }
  54. public String getResponsePhrase() {
  55. return tinyWRAPJNI.SipMessage_getResponsePhrase(swigCPtr, this);
  56. }
  57. public String getSipHeaderValue(String name, long index) {
  58. return tinyWRAPJNI.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, this, name, index);
  59. }
  60. public String getSipHeaderValue(String name) {
  61. return tinyWRAPJNI.SipMessage_getSipHeaderValue__SWIG_1(swigCPtr, this, name);
  62. }
  63. public String getSipHeaderParamValue(String name, String param, long index) {
  64. return tinyWRAPJNI.SipMessage_getSipHeaderParamValue__SWIG_0(swigCPtr, this, name, param, index);
  65. }
  66. public String getSipHeaderParamValue(String name, String param) {
  67. return tinyWRAPJNI.SipMessage_getSipHeaderParamValue__SWIG_1(swigCPtr, this, name, param);
  68. }
  69. public long getSipContentLength() {
  70. return tinyWRAPJNI.SipMessage_getSipContentLength(swigCPtr, this);
  71. }
  72. public long getSipContent(java.nio.ByteBuffer output, long maxsize) {
  73. return tinyWRAPJNI.SipMessage_getSipContent(swigCPtr, this, output, maxsize);
  74. }
  75. public SdpMessage getSdpMessage() {
  76. long cPtr = tinyWRAPJNI.SipMessage_getSdpMessage(swigCPtr, this);
  77. return (cPtr == 0) ? null : new SdpMessage(cPtr, false);
  78. }
  79. }