当前位置: 首页>>代码示例>>Java>>正文


Java Hessian2Output.flush方法代码示例

本文整理汇总了Java中com.caucho.hessian.io.Hessian2Output.flush方法的典型用法代码示例。如果您正苦于以下问题:Java Hessian2Output.flush方法的具体用法?Java Hessian2Output.flush怎么用?Java Hessian2Output.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.caucho.hessian.io.Hessian2Output的用法示例。


在下文中一共展示了Hessian2Output.flush方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encode

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel,
		Object msg) throws Exception {
	ChannelBufferOutputStream bout = new ChannelBufferOutputStream(
			dynamicBuffer(1024, ctx.getChannel().getConfig()
					.getBufferFactory()));
	bout.write(LENGTH_PLACEHOLDER);
	Hessian2Output h2o = new Hessian2Output(bout);
	try {
		h2o.writeObject(msg);
		h2o.flush();
	} finally {
		h2o.close();
	}
	ChannelBuffer encoded = bout.buffer();
	encoded.setInt(0, encoded.writerIndex() - 4);
	return encoded;
}
 
开发者ID:jbeetle,项目名称:BJAF3.x,代码行数:19,代码来源:HessianEncoder.java

示例2: 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
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:HessianDataFormat.java

示例3: encodeResponse

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public void encodeResponse(OutputStream outputStream, RpcResponse result)
		throws IOException {
        Hessian2Output out = new Hessian2Output(outputStream);  
        out.writeObject(result);  
        out.flush();
}
 
开发者ID:zhaoshiling1017,项目名称:voyage,代码行数:8,代码来源:HessianSerializer.java

示例4: encodeRequest

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public void encodeRequest(OutputStream outputStream, RpcRequest request)
		throws IOException {
       Hessian2Output out = new Hessian2Output(outputStream);  
       out.writeObject(request);
       out.flush();
}
 
开发者ID:zhaoshiling1017,项目名称:voyage,代码行数:8,代码来源:HessianSerializer.java

示例5: serialize

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@Override
public byte[] serialize(Object data) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Hessian2Output out = new Hessian2Output(bos);
    out.writeObject(data);
    out.flush();
    return bos.toByteArray();
}
 
开发者ID:chenxh,项目名称:rpc,代码行数:9,代码来源:Hessian2Serialization.java

示例6: toByteArray

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
@SneakyThrows
@Override
public byte[] toByteArray(T t) throws MetaClientException {
    checkNotNull(t);
    try (ByteArrayOutputStream os = new ByteArrayOutputStream(defaultByteArrayBufferSize)) {
        Hessian2Output ho = new Hessian2Output(os);
        ho.writeObject(t);
        ho.flush();
        return os.toByteArray();
    }
}
 
开发者ID:srarcbrsent,项目名称:tc,代码行数:12,代码来源:TcHessianSerializationMessageBodyConverter.java

示例7: 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);
    }
}
 
开发者ID:petrbouda,项目名称:joyrest,代码行数:14,代码来源:HessianReaderWriter.java

示例8: debugWritingSize

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
private static void debugWritingSize(Hessian2Output hos, FileOutputStream fos,
                                     String variableName, Long[] locations) {
    try {
        hos.flush();
        locations[0] = fos.getChannel().position();
        System.out.printf("%10d bytes : %s\n", (locations[0] - locations[1]), variableName);
        locations[1] = locations[0];
    } catch (IOException e) {
        return;
    }

}
 
开发者ID:ComputerArchitectureGroupPWr,项目名称:JGenerilo,代码行数:13,代码来源:Device.java

示例9: write

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
private static byte[] write(Object obj) throws Exception {
    ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
    Hessian2Output output=new Hessian2Output(outputStream);
    output.setSerializerFactory(SERIALIZER_FACTORY);
    output.writeObject(obj);
    output.flush();
    return outputStream.toByteArray();
}
 
开发者ID:qiujiayu,项目名称:AutoLoadCache,代码行数:9,代码来源:HessianTest.java

示例10: serialize

import com.caucho.hessian.io.Hessian2Output; //导入方法依赖的package包/类
public <T> byte[] serialize(T data) throws Exception {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Hessian2Output out = new Hessian2Output(bos);
    // out.startMessage();
    out.writeObject(data);
    // out.completeMessage();
    out.flush();
    return bos.toByteArray();
}
 
开发者ID:dinstone,项目名称:com.dinstone.rpc,代码行数:10,代码来源:HessianSerializer.java


注:本文中的com.caucho.hessian.io.Hessian2Output.flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。