| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | package org.webrtc; |
| 12 |
| 13 | /** Java wrapper for a C++ TurnCustomizer. */ |
| 14 | public class TurnCustomizer { |
| 15 | private long nativeTurnCustomizer; |
| 16 |
| 17 | public TurnCustomizer(long nativeTurnCustomizer) { |
| 18 | this.nativeTurnCustomizer = nativeTurnCustomizer; |
| 19 | } |
| 20 |
| 21 | public void dispose() { |
| 22 | checkTurnCustomizerExists(); |
| 23 | nativeFreeTurnCustomizer(nativeTurnCustomizer); |
| 24 | nativeTurnCustomizer = 0; |
| 25 | } |
| 26 |
| 27 | private static native void nativeFreeTurnCustomizer(long turnCustomizer); |
| 28 |
| 29 | /** Return a pointer to webrtc::TurnCustomizer. */ |
| 30 | @CalledByNative |
| 31 | long getNativeTurnCustomizer() { |
| 32 | checkTurnCustomizerExists(); |
| 33 | return nativeTurnCustomizer; |
| 34 | } |
| 35 |
| 36 | private void checkTurnCustomizerExists() { |
| 37 | if (nativeTurnCustomizer == 0) { |
| 38 | throw new IllegalStateException("TurnCustomizer has been disposed."); |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 |