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


Java Hessian2Output类代码示例

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


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

示例1: writeExternal

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
/**
 * using Hessian-SM serialize protocol
 * @param out - Hessian2Output
 * @throws IOException
 */

@Override
public void writeExternal(Hessian2Output out) throws IOException {
    out.writeInt(opType.value);
    out.writeInt(remove);
    out.writeInt(errorCode);
    out.writeBytes( BlockUtil.toKeyBytes( key));
    if ( value == null )
        out.writeBoolean(true);
    else {
        out.writeBoolean(false);
        out.writeBytes( Utils.valueToBytes( value));
    }

}
 
开发者ID:viant,项目名称:CacheStore,代码行数:21,代码来源:StoreParas.java

示例2: serialize

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
@Override
public byte[] serialize(Object obj) throws Exception {
    if(obj == null) {
        return null;
    }

    ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
    AbstractHessianOutput output=new Hessian2Output(outputStream);
    output.setSerializerFactory(serializerFactory);
    // 将对象写到流里
    output.writeObject(obj);
    output.flush();
    byte[] val=outputStream.toByteArray();
    output.close();
    return val;
}
 
开发者ID:hailin0,项目名称:pagecache-parent,代码行数:17,代码来源:HessianSerializer.java

示例3: 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

示例4: 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

示例5: writeStringMultiMap

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
public static boolean writeStringMultiMap(Hessian2Output dos, HashMap<String, ArrayList<String>> map) {
    try {
        dos.writeInt(map.size());
        for (String s : map.keySet()) {
            dos.writeString(s);
            ArrayList<String> values = map.get(s);
            dos.writeInt(values.size());
            for (String str : values) {
                dos.writeString(str);
            }
        }
    } catch (IOException e) {
        return false;
    }
    return true;
}
 
开发者ID:ComputerArchitectureGroupPWr,项目名称:JGenerilo,代码行数:17,代码来源:FileTools.java

示例6: writeIntArray

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
public static boolean writeIntArray(Hessian2Output dos, int[] intArray) {
    try {
        if (intArray == null) {
            dos.writeInt(0);
            return true;
        }
        dos.writeInt(intArray.length);
        for (int i : intArray) {
            dos.writeInt(i);
        }
    } catch (IOException e) {
        return false;
    }

    return true;
}
 
开发者ID:ComputerArchitectureGroupPWr,项目名称:JGenerilo,代码行数:17,代码来源:FileTools.java

示例7: writePrimitiveSite

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
public static boolean writePrimitiveSite(Hessian2Output dos, PrimitiveSite p, Device device, HashPool<PrimitivePinMap> primitivePinPool) {
    try {
        // Write Name
        dos.writeString(p.getName());

        // Write Type
        dos.writeInt(p.getType().ordinal());

        // Write Tile (Unique Integer)
        dos.writeInt(p.getTile().getUniqueAddress());

        // Write PinMap
        dos.writeInt(primitivePinPool.getEnumerationValue(new PrimitivePinMap(p.getPins())));

    } catch (IOException e) {
        return false;
    }
    return true;
}
 
开发者ID:ComputerArchitectureGroupPWr,项目名称:JGenerilo,代码行数:20,代码来源:FileTools.java

示例8: writeWireHashMap

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
public static boolean writeWireHashMap(Hessian2Output dos, WireHashMap wires,
                                       HashPool<WireArray> wireArrayPool, HashPool<WireArrayConnection> wireConnectionPool) {

    int[] wireConnections;
    if (wires == null) {
        wireConnections = new int[0];
    } else {
        wireConnections = new int[wires.size()];
        int ndx = 0;
        for (Integer key : wires.keySet()) {
            WireArrayConnection tmp = new WireArrayConnection(key, wireArrayPool.getEnumerationValue(new WireArray(wires.get(key))));
            wireConnections[ndx] = wireConnectionPool.getEnumerationValue(tmp);
            ndx++;
        }
    }

    writeIntArray(dos, wireConnections);

    return true;
}
 
开发者ID:ComputerArchitectureGroupPWr,项目名称:JGenerilo,代码行数:21,代码来源:FileTools.java

示例9: serialize

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
@Override
public byte[] serialize(final Object obj) throws Exception {
    if(obj == null) {
        return null;
    }

    ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
    AbstractHessianOutput output=new Hessian2Output(outputStream);
    output.setSerializerFactory(SERIALIZER_FACTORY);
    // 将对象写到流里
    output.writeObject(obj);
    output.flush();
    byte[] val=outputStream.toByteArray();
    output.close();
    return val;
}
 
开发者ID:qiujiayu,项目名称:AutoLoadCache,代码行数:17,代码来源:HessianSerializer.java

示例10: 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();
    }
}
 
开发者ID:yu199195,项目名称:happylifeplat-transaction,代码行数:14,代码来源:HessianSerialize.java

示例11: 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

示例12: 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

示例13: 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

示例14: toBytes

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
@Override
  public byte[] toBytes(Object object) {
	    ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
	Hessian2Output oos = new Hessian2Output(baos);
	oos.writeObject(object);
	oos.flushBuffer();
}
catch (java.io.IOException ioe) {
	throw new RuntimeException(ioe.getMessage(), ioe);
}
return baos.toByteArray();
  }
 
开发者ID:viant,项目名称:CacheStore,代码行数:14,代码来源:HessianSerializer.java

示例15: writeExternal

import com.caucho.hessian.io.Hessian2Output; //导入依赖的package包/类
@Override
public void writeExternal(Hessian2Output out) throws IOException {
    out.writeInt(opType.value);
    if ( size() == 0)
        out.writeBoolean(true);
    else {
        out.writeBoolean( false);
        out.writeInt(size());
        for (StoreParas each : list ) {
            //out.writeBytes( each.toBytes());
            out.writeObject( each);
        }
    }
}
 
开发者ID:viant,项目名称:CacheStore,代码行数:15,代码来源:StoreParaList.java


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