| // Java Package testpkg is a proxy for talking to a Go program. |
| // gobind -lang=java golang.org/x/mobile/bind/java/testpkg |
| // |
| // File is generated by gobind. Do not edit. |
| package go.testpkg; |
| |
| import go.Seq; |
| |
| public abstract class Testpkg { |
| private Testpkg() {} // uninstantiable |
| |
| public static long Add(long x, long y) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| long _result; |
| _in.writeInt(x); |
| _in.writeInt(y); |
| Seq.send(DESCRIPTOR, CALL_Add, _in, _out); |
| _result = _out.readInt(); |
| return _result; |
| } |
| |
| public static byte[] AppendToString(String str, byte[] someBytes) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| byte[] _result; |
| _in.writeUTF16(str); |
| _in.writeByteArray(someBytes); |
| Seq.send(DESCRIPTOR, CALL_AppendToString, _in, _out); |
| _result = _out.readByteArray(); |
| return _result; |
| } |
| |
| public static byte[] BytesAppend(byte[] a, byte[] b) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| byte[] _result; |
| _in.writeByteArray(a); |
| _in.writeByteArray(b); |
| Seq.send(DESCRIPTOR, CALL_BytesAppend, _in, _out); |
| _result = _out.readByteArray(); |
| return _result; |
| } |
| |
| public static void CallE(I i) throws Exception { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_CallE, _in, _out); |
| String _err = _out.readUTF16(); |
| if (_err != null) { |
| throw new Exception(_err); |
| } |
| } |
| |
| public static void CallF(I i) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_CallF, _in, _out); |
| } |
| |
| public static I CallI(I i) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| I _result; |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_CallI, _in, _out); |
| _result = new I.Proxy(_out.readRef()); |
| return _result; |
| } |
| |
| public static S CallS(I i) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| S _result; |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_CallS, _in, _out); |
| _result = new S(_out.readRef()); |
| return _result; |
| } |
| |
| public static long CallV(I i) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| long _result; |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_CallV, _in, _out); |
| _result = _out.readInt(); |
| return _result; |
| } |
| |
| public static long CallVE(I i) throws Exception { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| long _result; |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_CallVE, _in, _out); |
| _result = _out.readInt(); |
| String _err = _out.readUTF16(); |
| if (_err != null) { |
| throw new Exception(_err); |
| } |
| return _result; |
| } |
| |
| public static void Err(String s) throws Exception { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeUTF16(s); |
| Seq.send(DESCRIPTOR, CALL_Err, _in, _out); |
| String _err = _out.readUTF16(); |
| if (_err != null) { |
| throw new Exception(_err); |
| } |
| } |
| |
| public static void GC() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| Seq.send(DESCRIPTOR, CALL_GC, _in, _out); |
| } |
| |
| public interface I extends go.Seq.Object { |
| public void E() throws Exception; |
| |
| public void F(); |
| |
| public I I(); |
| |
| public S S(); |
| |
| public String String(); |
| |
| public long V(); |
| |
| public long VE() throws Exception; |
| |
| public static abstract class Stub implements I { |
| static final String DESCRIPTOR = "go.testpkg.I"; |
| |
| private final go.Seq.Ref ref; |
| public Stub() { |
| ref = go.Seq.createRef(this); |
| } |
| |
| public go.Seq.Ref ref() { return ref; } |
| |
| public void call(int code, go.Seq in, go.Seq out) { |
| switch (code) { |
| case Proxy.CALL_E: { |
| try { |
| this.E(); |
| out.writeUTF16(null); |
| } catch (Exception e) { |
| out.writeUTF16(e.getMessage()); |
| } |
| return; |
| } |
| case Proxy.CALL_F: { |
| this.F(); |
| return; |
| } |
| case Proxy.CALL_I: { |
| I result = this.I(); |
| out.writeRef(result.ref()); |
| return; |
| } |
| case Proxy.CALL_S: { |
| S result = this.S(); |
| out.writeRef(result.ref()); |
| return; |
| } |
| case Proxy.CALL_String: { |
| String result = this.String(); |
| out.writeUTF16(result); |
| return; |
| } |
| case Proxy.CALL_V: { |
| long result = this.V(); |
| out.writeInt(result); |
| return; |
| } |
| case Proxy.CALL_VE: { |
| try { |
| long result = this.VE(); |
| out.writeInt(result); |
| out.writeUTF16(null); |
| } catch (Exception e) { |
| long result = 0; |
| out.writeInt(result); |
| out.writeUTF16(e.getMessage()); |
| } |
| return; |
| } |
| default: |
| throw new RuntimeException("unknown code: "+ code); |
| } |
| } |
| } |
| |
| static final class Proxy implements I { |
| static final String DESCRIPTOR = Stub.DESCRIPTOR; |
| |
| private go.Seq.Ref ref; |
| |
| Proxy(go.Seq.Ref ref) { this.ref = ref; } |
| |
| public go.Seq.Ref ref() { return ref; } |
| |
| public void call(int code, go.Seq in, go.Seq out) { |
| throw new RuntimeException("cycle: cannot call proxy"); |
| } |
| |
| public void E() throws Exception { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_E, _in, _out); |
| String _err = _out.readUTF16(); |
| if (_err != null) { |
| throw new Exception(_err); |
| } |
| } |
| |
| public void F() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_F, _in, _out); |
| } |
| |
| public I I() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| I _result; |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_I, _in, _out); |
| _result = new I.Proxy(_out.readRef()); |
| return _result; |
| } |
| |
| public S S() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| S _result; |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_S, _in, _out); |
| _result = new S(_out.readRef()); |
| return _result; |
| } |
| |
| public String String() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| String _result; |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_String, _in, _out); |
| _result = _out.readUTF16(); |
| return _result; |
| } |
| |
| public long V() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| long _result; |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_V, _in, _out); |
| _result = _out.readInt(); |
| return _result; |
| } |
| |
| public long VE() throws Exception { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| long _result; |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_VE, _in, _out); |
| _result = _out.readInt(); |
| String _err = _out.readUTF16(); |
| if (_err != null) { |
| throw new Exception(_err); |
| } |
| return _result; |
| } |
| |
| static final int CALL_E = 0x10a; |
| static final int CALL_F = 0x20a; |
| static final int CALL_I = 0x30a; |
| static final int CALL_S = 0x40a; |
| static final int CALL_String = 0x50a; |
| static final int CALL_V = 0x60a; |
| static final int CALL_VE = 0x70a; |
| } |
| } |
| |
| public static void Keep(I i) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeRef(i.ref()); |
| Seq.send(DESCRIPTOR, CALL_Keep, _in, _out); |
| } |
| |
| public static S New() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| S _result; |
| Seq.send(DESCRIPTOR, CALL_New, _in, _out); |
| _result = new S(_out.readRef()); |
| return _result; |
| } |
| |
| public static long NumSCollected() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| long _result; |
| Seq.send(DESCRIPTOR, CALL_NumSCollected, _in, _out); |
| _result = _out.readInt(); |
| return _result; |
| } |
| |
| public static final class S implements go.Seq.Object { |
| private static final String DESCRIPTOR = "go.testpkg.S"; |
| private static final int CALL_F = 0x00c; |
| private static final int CALL_String = 0x10c; |
| |
| private go.Seq.Ref ref; |
| |
| private S(go.Seq.Ref ref) { this.ref = ref; } |
| |
| public go.Seq.Ref ref() { return ref; } |
| |
| public void call(int code, go.Seq in, go.Seq out) { |
| throw new RuntimeException("internal error: cycle: cannot call concrete proxy"); |
| } |
| |
| |
| public void F() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_F, _in, _out); |
| } |
| |
| public String String() { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| String _result; |
| _in.writeRef(ref); |
| Seq.send(DESCRIPTOR, CALL_String, _in, _out); |
| _result = _out.readUTF16(); |
| return _result; |
| } |
| |
| @Override public boolean equals(Object o) { |
| if (o == null || !(o instanceof S)) { |
| return false; |
| } |
| S that = (S)o; |
| return true; |
| } |
| |
| @Override public int hashCode() { |
| return java.util.Arrays.hashCode(new Object[] {}); |
| } |
| |
| @Override public String toString() { |
| StringBuilder b = new StringBuilder(); |
| b.append("S").append("{"); |
| return b.append("}").toString(); |
| } |
| |
| } |
| |
| public static String StrDup(String s) { |
| go.Seq _in = new go.Seq(); |
| go.Seq _out = new go.Seq(); |
| String _result; |
| _in.writeUTF16(s); |
| Seq.send(DESCRIPTOR, CALL_StrDup, _in, _out); |
| _result = _out.readUTF16(); |
| return _result; |
| } |
| |
| private static final int CALL_Add = 1; |
| private static final int CALL_AppendToString = 2; |
| private static final int CALL_BytesAppend = 3; |
| private static final int CALL_CallE = 4; |
| private static final int CALL_CallF = 5; |
| private static final int CALL_CallI = 6; |
| private static final int CALL_CallS = 7; |
| private static final int CALL_CallV = 8; |
| private static final int CALL_CallVE = 9; |
| private static final int CALL_Err = 10; |
| private static final int CALL_GC = 11; |
| private static final int CALL_Keep = 12; |
| private static final int CALL_New = 13; |
| private static final int CALL_NumSCollected = 14; |
| private static final int CALL_StrDup = 15; |
| private static final String DESCRIPTOR = "testpkg"; |
| } |