本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}