本文整理汇总了Java中de.ruedigermoeller.serialization.FSTObjectInput.readObject方法的典型用法代码示例。如果您正苦于以下问题:Java FSTObjectInput.readObject方法的具体用法?Java FSTObjectInput.readObject怎么用?Java FSTObjectInput.readObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.ruedigermoeller.serialization.FSTObjectInput
的用法示例。
在下文中一共展示了FSTObjectInput.readObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defst
import de.ruedigermoeller.serialization.FSTObjectInput; //导入方法依赖的package包/类
/**
* fst 反序列化
*
* byte[] -> object
*
* @param inputStream
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T defst(InputStream inputStream) {
T result = null;
//
AssertHelper.notNull(inputStream, "The InputStream must not be null");
//
FSTObjectInput in = null;
try {
in = fstConfiguration.getObjectInput(inputStream);
result = (T) in.readObject();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
// DON'T: in.close(); here prevents reuse and will result in an
// exception
}
return result;
}
示例2: defstWithFactory
import de.ruedigermoeller.serialization.FSTObjectInput; //导入方法依赖的package包/类
/**
* fst 反序列化
*
* byte[] -> object
*
* @param inputStream
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T defstWithFactory(InputStream inputStream) {
AssertHelper.notNull(inputStream, "The InputStream must not be null");
//
T result = null;
FSTObjectInput in = null;
try {
in = fstConfiguration.getObjectInput(inputStream);
result = (T) in.readObject();
} catch (Exception e) {
LOGGER.error(new StringBuilder("Exception encountered during defstWithFactory()").toString(), e);
} finally {
// DON'T: in.close(); here prevents reuse and will result in an
// exception
}
return result;
}
示例3: decode
import de.ruedigermoeller.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object decode(InputStream in, ClassResolver classResolver) throws Exception
{
FSTObjectInput fin = conf.getObjectInput(in);
Object result = fin.readObject();
in.close();
return result;
}
示例4: deserialize
import de.ruedigermoeller.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T deserialize(byte[] source, Class<T> clazz) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
FSTObjectInput in = conf.getObjectInput(source, 0, source.length);
try {
return (T) in.readObject(clazz);
} catch (Exception e) {
throw new IOException("Cannot read object", e);
}
}
示例5: deserialize
import de.ruedigermoeller.serialization.FSTObjectInput; //导入方法依赖的package包/类
/**
* Factory method for creating an instance by reading it from an XML file.
* <b>It will close the input stream when it's finished.</b>
* @param is a stream to a file created by XMLEncoder.writeObject()
* @return instance of serialized object, to be cast to a proper class by
* receiver.
* @throws java.io.IOException
* @throws java.lang.ClassNotFoundException
*/
public static Object deserialize(InputStream is) throws IOException, ClassNotFoundException {
FSTObjectInput in = conf.getObjectInput(is);
Object obj = in.readObject();
return obj;
}