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

📄 serializablecoder.java

📁 CroftSoft Code Library是一个开源的可移植的纯Java游戏库
💻 JAVA
字号:
     package com.croftsoft.core.io;     import java.io.*;     /*********************************************************************     * An Encoder and Parser implementation that uses object serialization.     *     * @version     *   2003-05-28     * @since     *   2003-05-13     * @author     *   <a href="http://www.croftsoft.com/">David Wallace Croft</a>     *********************************************************************/     public final class  SerializableCoder       implements Encoder, Parser     //////////////////////////////////////////////////////////////////////     //////////////////////////////////////////////////////////////////////     {     public static final SerializableCoder  INSTANCE       = new SerializableCoder ( );     //////////////////////////////////////////////////////////////////////     //////////////////////////////////////////////////////////////////////     public byte [ ]  encode ( Object  object )       throws IOException     //////////////////////////////////////////////////////////////////////     {       return SerializableLib.compress ( ( Serializable ) object );     }     public Object  parse (       InputStream  inputStream,       int          contentLength )       throws IOException     //////////////////////////////////////////////////////////////////////     {       try       {         return SerializableLib.load ( inputStream );       }       catch ( ClassNotFoundException  ex )       {         throw ( IOException ) new IOException ( ).initCause ( ex );       }     }     //////////////////////////////////////////////////////////////////////     //////////////////////////////////////////////////////////////////////     private  SerializableCoder ( ) { }     //////////////////////////////////////////////////////////////////////     //////////////////////////////////////////////////////////////////////     }

⌨️ 快捷键说明

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