
wee0.codec.ISerializer Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2016-2022, wee0.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package wee0.codec;
import java.io.IOException;
/**
* 序列化规范接口
* @author baihw
* @date 2017年3月31日
**/
/**
*
* examples:
*
**/
public interface ISerializer{
/**
* 获取当前序列化处理器名称
*
* @return 当前序列化处理器名称
*/
public String name();
/**
* 执行对象序列化处理
*
* @param obj 要序列化的对象
* @return 序列化后的数据
* @throws IOException 序列化操作异常
*/
public byte[] serialize( Object obj ) throws IOException;
/**
* 执行对象序反列化处理
*
* @param bytes 要反序列化的数据
* @return 序列化前的对象
* @throws IOException 序列化操作异常
*/
public Object deserialize( byte[] bytes ) throws IOException;
/**
* 执行对象序反列化处理
*
* @param bytes 要反序列化的数据
* @param classLoader 反序列化对象使用的类加载器
* @return 序列化前的对象
* @throws IOException 序列化操作异常
*/
public Object deserialize( byte[] bytes, ClassLoader classLoader ) throws IOException;
} // end interface
© 2015 - 2025 Weber Informatics LLC | Privacy Policy