本文整理了Java中android.system.Os.pipe()
方法的一些代码示例,展示了Os.pipe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Os.pipe()
方法的具体详情如下:
包路径:android.system.Os
类名称: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];
内容来源于网络,如有侵权,请联系作者删除!