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


Java FSTObjectInput.readInt方法代码示例

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


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

示例1: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@SuppressWarnings({ "unused", "rawtypes" })
@Override
   public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPositioin) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
       try {
       	//Sentence sen= new Sentence();
   		int id = in.readInt();
   		LexicalToken[] sentence = (LexicalToken[]) in.readObjectInternal();
   		String autoString = (String) in.readObjectInternal();
   		Sentence sen = new Sentence(sentence, id, autoString);
           //in.registerObject(sen, streamPositioin, serializationInfo, referencee);
   		return sen;
       } catch (Throwable th) {
           FSTUtil.<RuntimeException>rethrow(th);
       }
       return null;
   }
 
开发者ID:ramusa2,项目名称:CandCNFPerceptronParser,代码行数:17,代码来源:SentenceFSTSerializer.java

示例2: readByteArrayFromFile

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
public byte[] readByteArrayFromFile(File file, CompressionType compType) {
	try {
		BufferedInputStream BIS = new BufferedInputStream(new FileInputStream(file));
		FSTObjectInput ois = conf.get().getObjectInput(BIS);
		byte[] serialized;
		switch(compType) {
		case NONE:
		case GZIP:
			serialized = (byte[]) ois.readObject();
			break;
		case LZ4:
			ois.readInt();
			serialized = (byte[]) ois.readObject();
		default:
			serialized = null;
		}
		BIS.close();
		return serialized;
	}
	catch(Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:ramusa2,项目名称:CandCNFPerceptronParser,代码行数:25,代码来源:FSTSerializerAndCompressor.java

示例3: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
    try {
        int len = in.readInt();
        ArrayList res = new ArrayList(len);
        in.registerObject(res, streamPosition,serializationInfo, referencee);
        for ( int i = 0; i < len; i++ ) {
            final Object o = in.readObjectInternal(null);
            res.add(o);
        }
        return res;
    } catch (Throwable th) {
        FSTUtil.<RuntimeException>rethrow(th);
    }
    return null;
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:17,代码来源:FSTArrayListSerializer.java

示例4: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
    try {
        // note: unlike with list's JDK uses a single wrapper for unmodifiable maps, so information regarding ordering gets lost.
        // as the enclosed map is private, there is also no possibility to detect that case
        // we could always create a linkedhashmap here, but this would have major performance drawbacks.

        // this only hits JSON codec as JSON codec does not implement a full JDK-serialization fallback (like the binary codecs)
        int len = in.readInt();
        if (UNMODIFIABLE_MAP_CLASS.isAssignableFrom(objectClass)) {
            Map res = new HashMap(len);
            in.registerObject(res, streamPosition, serializationInfo, referencee);
            for (int i = 0; i < len; i++) {
                Object key = in.readObjectInternal(null);
                Object val = in.readObjectInternal(null);
                res.put(key, val);
            }
            return Collections.unmodifiableMap(res);
        }
    } catch (Throwable th) {
        FSTUtil.<RuntimeException>rethrow(th);
    }
    return null;
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:26,代码来源:FSTJSonUnmodifiableMapSerializer.java

示例5: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
    Object res = null;
    int len = in.readInt();
    if ( objectClass == HashMap.class ) {
        res = new HashMap(len);
    } else
    if ( objectClass == Hashtable.class ) {
        res = new Hashtable(len);
    } else
    {
        res = objectClass.newInstance();
    }
    in.registerObject(res, streamPosition,serializationInfo, referencee);
    Map col = (Map)res;
    for ( int i = 0; i < len; i++ ) {
        Object key = in.readObjectInternal(null);
        Object val = in.readObjectInternal(null);
        col.put(key,val);
    }
    return res;
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:23,代码来源:FSTMapSerializer.java

示例6: readLZ4DecompressedLengthFromFile

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
public int readLZ4DecompressedLengthFromFile(File file) {
	try {
		BufferedInputStream BIS = new BufferedInputStream(new FileInputStream(file));
		FSTObjectInput ois = conf.get().getObjectInput(BIS);
		int decompressedLength = ois.readInt();
		BIS.close();
		return decompressedLength;
	}
	catch(Exception e) {
		e.printStackTrace();
		return -1;
	}
}
 
开发者ID:ramusa2,项目名称:CandCNFPerceptronParser,代码行数:14,代码来源:FSTSerializerAndCompressor.java

示例7: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
    int len = in.readInt();
    Class elemCl = FSTUtil.getRealEnumClass(in.readClass().getClazz());
    EnumSet enSet = EnumSet.noneOf(elemCl);
    in.registerObject(enSet,streamPosition,serializationInfo, referencee); // IMPORTANT, else tracking double objects will fail
    for (int i = 0; i < len; i++)
        enSet.add(in.readObjectInternal(Enum.class));
    return enSet;
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:11,代码来源:FSTEnumSetSerializer.java

示例8: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee,
                          int streamPosition) throws Exception {
    int len = in.readInt();
    byte[] buf = new byte[len];
    in.read(buf);
    BigInteger bigInteger = new BigInteger(buf);
    in.registerObject(bigInteger,streamPosition,serializationInfo,referencee);
    return bigInteger;
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:11,代码来源:FSTBigIntegerSerializer.java

示例9: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
    int len = in.readInt();
    Class elemCl = FSTUtil.getRealEnumClass(in.getClassForName( in.readStringUTF() ));
    EnumSet enSet = EnumSet.noneOf(elemCl);
    in.registerObject(enSet,streamPosition,serializationInfo, referencee); // IMPORTANT, else tracking double objects will fail
    for (int i = 0; i < len; i++) {
        String val = in.readStringUTF();
        enSet.add(Enum.valueOf(elemCl,val));
    }
    return enSet;
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:13,代码来源:FSTCPEnumSetSerializer.java

示例10: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTFieldInfo referencee,
		int streamPosition) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
	byte[] buf = new byte[in.readInt()];
	in.read(buf);
	PeerAddress address = new PeerAddress(buf);
	in.registerObject(address, streamPosition, serializationInfo, referencee);
	return address;
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:10,代码来源:FSTPeerAddressSerializer.java

示例11: instantiate

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Object instantiate(Class objectClass, FSTObjectInput in,
		FSTClazzInfo serializationInfo, FSTFieldInfo reference,
		int streamPosition) throws IOException, ClassNotFoundException,
		InstantiationException, IllegalAccessException {
	DAGObject obj = null;
	boolean idOnly = in.readBoolean();
	if (idOnly) {
		int id = in.readInt();

		if (DAGNode.class.isAssignableFrom(objectClass))
			obj = DirectedAcyclicGraph.selfRef_.getNodeByID(id);
		else if (DAGEdge.class.isAssignableFrom(objectClass))
			obj = DirectedAcyclicGraph.selfRef_.getEdgeByID(id);
		else {
			obj = (DAGObject) objectClass.newInstance();
			obj.setID(id);
		}
		in.registerObject(obj, streamPosition, serializationInfo, reference);
		return obj;
	} else {
		obj = (DAGObject) objectClass.newInstance();
		in.defaultReadObject(reference, serializationInfo, obj);
		in.registerObject(obj, streamPosition, serializationInfo, reference);
	}
	return obj;
}
 
开发者ID:Effervex,项目名称:DagYo,代码行数:29,代码来源:FSTDAGObjectSerialiser.java

示例12: readInt

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
public static int readInt(InputStream stream) throws IOException
{
	FSTObjectInput in = conf.getObjectInput(stream);
	int i = in.readInt();
	return i;
}
 
开发者ID:ramusa2,项目名称:CandCNFPerceptronParser,代码行数:7,代码来源:FastSerializationUtil.java


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