本文整理汇总了Java中com.caucho.hessian.io.Hessian2Output.startMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Hessian2Output.startMessage方法的具体用法?Java Hessian2Output.startMessage怎么用?Java Hessian2Output.startMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.caucho.hessian.io.Hessian2Output
的用法示例。
在下文中一共展示了Hessian2Output.startMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshal
import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public void marshal(final Exchange exchange, final Object graph, final OutputStream outputStream) throws Exception {
final Hessian2Output out = new Hessian2Output(outputStream);
try {
out.startMessage();
out.writeObject(graph);
out.completeMessage();
} finally {
out.flush();
try {
out.close();
} catch (IOException e) {
// ignore
}
}
}
示例2: serialize
import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public void serialize(OutputStream output, Object object) {
Hessian2Output ho = new Hessian2Output(output);
try {
ho.startMessage();
ho.writeObject(object);
ho.completeMessage();
ho.close();
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: serialize
import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public byte[] serialize(Object obj) throws Exception {
UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
Hessian2Output out = new Hessian2Output(bos);
out.startMessage();
out.writeObject(obj);
out.completeMessage();
out.close();
return bos.toByteArray();
}
示例4: writeTo
import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public void writeTo(InternalResponse<?> response, InternalRequest<?> request) {
try {
Hessian2Output out = new Hessian2Output(response.getOutputStream());
out.startMessage();
out.writeObject(response.getEntity().get());
out.completeMessage();
out.flushBuffer();
out.flush();
} catch (IOException e) {
throw new RuntimeException("An error occurred during marshalling to Hessian.", e);
}
}