android.system.Os.pipe()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中android.system.Os.pipe()方法的一些代码示例,展示了Os.pipe()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Os.pipe()方法的具体详情如下:
包路径:android.system.Os
类名称:Os
方法名:pipe

Os.pipe介绍

暂无

代码示例

代码示例来源:origin: julian-klode/dns66

private void runVpn() throws InterruptedException, ErrnoException, IOException, VpnNetworkException {
  // Allocate the buffer for a single packet.
  byte[] packet = new byte[32767];
  // A pipe we can interrupt the poll() call with by closing the interruptFd end
  FileDescriptor[] pipes = Os.pipe();
  mInterruptFd = pipes[0];
  mBlockFd = pipes[1];
  // Authenticate and configure the virtual network interface.
  try (ParcelFileDescriptor pfd = configure()) {
    // Read and write views of the tun device
    FileInputStream inputStream = new FileInputStream(pfd.getFileDescriptor());
    FileOutputStream outFd = new FileOutputStream(pfd.getFileDescriptor());
    // Now we are connected. Set the flag and show the message.
    if (notify != null)
      notify.run(AdVpnService.VPN_STATUS_RUNNING);
    // We keep forwarding packets till something goes wrong.
    while (doOne(inputStream, outFd, packet))
      ;
  } finally {
    mBlockFd = FileHelper.closeOrWarn(mBlockFd, TAG, "runVpn: Could not close blockFd");
  }
}

代码示例来源:origin: iTXTech/Daedalus

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void process() {
  try {
    FileDescriptor[] pipes = Os.pipe();
    mInterruptFd = pipes[0];
    mBlockFd = pipes[1];

代码示例来源:origin: iTXTech/Daedalus

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void process() {
  try {
    FileDescriptor[] pipes = Os.pipe();
    mInterruptFd = pipes[0];
    mBlockFd = pipes[1];

代码示例来源:origin: iTXTech/Daedalus

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void process() {
  try {
    FileDescriptor[] pipes = Os.pipe();
    mInterruptFd = pipes[0];
    mBlockFd = pipes[1];

相关文章