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

📄 dataencoder.java

📁 这是一个分布式通信程序框架源程序
💻 JAVA
字号:
package dim;

/**
  * This interface should be implemented by any class that produces outgoing data.
  * An instance of this interface can be passed to the methods
  * {@link Server#addService <code>addService()</code>}
  * and {@link Client#send(java.lang.String, CompletionHandler, int, int, boolean) <code>send()</code>}.
  * <P>Example:
  * <blockquote><pre>
  * class MyDataEncoder implements DataEncoder
  * {
  *   MutableMemory theData = new MutableMemory(32); //allocate 32 bytes
  *   public Memory encodeData()
  *   {
  *     return theData();
  *   }
  *   private void update(String aString)
  *   {
  *     // if the String length exceed the memory allocated you should take some action
  *     theData.setString(aString);
  *   }
  * }
  * </pre></blockquote>
  * @author M.Jonker Cern
  * @version v1.2
  */
public interface DataEncoder
{
    /**
      * This method is invoked when the native code needs the outgoing data from the
      * non native code.
      * @return theData An oject holding a reference to the native memory where the outgoing data is stored.
      * The implementing object is free to reuse the returned object in subsequent invokations.
      * The {@link MutableMemory} methods <code>set'<i>Primitive</i>'()</code> and
      * <code>copyFrom'<i>Primitive</i>'Array()</code>
      * can be used to fill the information in a mutable native memory object.
      */
    Memory encodeData();		        // invoked by native client requests, update_service(), send()
}

⌨️ 快捷键说明

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