コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public void outStream(int type, long memPtr) throws Exception {
    try (PlatformMemory mem = platformCtx.memory().get(memPtr)) {
      PlatformOutputStream out = mem.output();

      BinaryRawWriterEx writer = platformCtx.writer(out);

      target.processOutStream(type, writer);

      out.synchronize();
    } catch (Exception e) {
      throw target.convertException(e);
    }
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public void inStreamOutStream(int type, long inMemPtr, long outMemPtr) throws Exception {
    try (PlatformMemory inMem = platformCtx.memory().get(inMemPtr)) {
      BinaryRawReaderEx reader = platformCtx.reader(inMem);

      try (PlatformMemory outMem = platformCtx.memory().get(outMemPtr)) {
        PlatformOutputStream out = outMem.output();

        BinaryRawWriterEx writer = platformCtx.writer(out);

        target.processInStreamOutStream(type, reader, writer);

        out.synchronize();
      }
    } catch (Exception e) {
      throw target.convertException(e);
    }
  }
コード例 #3
0
  /** {@inheritDoc} */
  @Override
  public Object inObjectStreamOutObjectStream(int type, Object arg, long inMemPtr, long outMemPtr)
      throws Exception {
    PlatformMemory inMem = null;
    PlatformMemory outMem = null;

    try {
      BinaryRawReaderEx reader = null;

      if (inMemPtr != 0) {
        inMem = platformCtx.memory().get(inMemPtr);

        reader = platformCtx.reader(inMem);
      }

      PlatformOutputStream out = null;
      BinaryRawWriterEx writer = null;

      if (outMemPtr != 0) {
        outMem = platformCtx.memory().get(outMemPtr);

        out = outMem.output();

        writer = platformCtx.writer(out);
      }

      PlatformTarget res =
          target.processInObjectStreamOutObjectStream(type, unwrapProxy(arg), reader, writer);

      if (out != null) out.synchronize();

      return wrapProxy(res);
    } catch (Exception e) {
      throw target.convertException(e);
    } finally {
      try {
        if (inMem != null) inMem.close();
      } finally {
        if (outMem != null) outMem.close();
      }
    }
  }