⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pipebundle.java

📁 Java p2p程序设计2002年版
💻 JAVA
字号:
package net.jxta.impl.shell.bin.ping;import java.io.*;import net.jxta.exception.*;import net.jxta.discovery.*;import net.jxta.endpoint.*;import net.jxta.pipe.*;import net.jxta.peergroup.*;import net.jxta.document.*;import net.jxta.id.*;import net.jxta.protocol.*;import java.util.*;/** * This class bundles a pipe advertisement with its input * and output pipes and their creation methods. */public class PipeBundle {    private PipeAdvertisement ad;    private PipeService ps;    private InputPipe iPipe = null;    private OutputPipe oPipe = null;        /** Creates new PipeBundle */    public PipeBundle(PipeAdvertisement ad, PipeService ps) {        this.ad = ad;        this.ps = ps;    }        /**     * Returns the input pipe associated with this PipeBundle     */    public InputPipe getInputPipe()  {        try {            if(iPipe==null)                return (iPipe = (InputPipe)ps.createInputPipe(ad));            else return iPipe;        } catch (IOException e) {            return null;        }    }        /**     * Returns the output pipe associated with this PipeBundle     */    public OutputPipe getOutputPipe()  {        try {            if(oPipe==null)                return (oPipe = (OutputPipe)ps.createOutputPipe(ad, 50000));            else return oPipe;        } catch (IOException e) {            return null;        }    }        /**     * Returns the advertisment associated with this PipeBundle     */    public PipeAdvertisement getAdvertisement() {        return ad;    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -