本文整理汇总了Java中org.nustaq.serialization.FSTObjectInput类的典型用法代码示例。如果您正苦于以下问题:Java FSTObjectInput类的具体用法?Java FSTObjectInput怎么用?Java FSTObjectInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FSTObjectInput类属于org.nustaq.serialization包,在下文中一共展示了FSTObjectInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LibraryMatchRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
public static TargetMatchScoring LibraryMatchRead(String Filename, String LibID) throws FileNotFoundException {
if (!new File(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS").exists()) {
return null;
}
TargetMatchScoring match = null;
try {
Logger.getRootLogger().info("Loading Target library match results to file:" + FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
match = (TargetMatchScoring) in.readObject();
in.close();
fileIn.close();
} catch (Exception ex) {
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return null;
}
return match;
}
示例2: FasterSerialzationRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
public static FastaParser FasterSerialzationRead(String Filename) throws FileNotFoundException {
if (!new File(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + ".FastaSer").exists()) {
return null;
}
FastaParser fastareader = null;
try {
org.apache.log4j.Logger.getRootLogger().info("Loading fasta serialization to file:" + FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + ".FastaSer..");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + ".FastaSer");
FSTObjectInput in = new FSTObjectInput(fileIn);
fastareader = (FastaParser) in.readObject();
in.close();
fileIn.close();
} catch (Exception ex) {
org.apache.log4j.Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return null;
}
return fastareader;
}
示例3: FSFragmentLibRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private static FragmentLibManager FSFragmentLibRead(String path, String LibID1) {
if (!new File(path + LibID1 + ".serFS").exists()) {
Logger.getRootLogger().debug(path + LibID1 + ".serFS does not exsit.");
return null;
}
try {
Logger.getRootLogger().info("Reading spectral library from file:" + path + LibID1 + ".serFS...");
FileInputStream fileIn = new FileInputStream(path + LibID1 + ".serFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
FragmentLibManager FragLib = (FragmentLibManager) in.readObject();
in.close();
fileIn.close();
return FragLib;
} catch (Exception ex) {
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return null;
}
}
示例4: FSFragmentLibRead_Old
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private static FragmentLibManager FSFragmentLibRead_Old(String path, String LibID1) {
if (!new File(path + LibID1 + ".serFS").exists()) {
Logger.getRootLogger().debug(path + LibID1 + ".serFS does not exsit.");
return null;
}
try {
Logger.getRootLogger().info("Reading internal spectral library from file:" + path + LibID1 + ".serFS...");
FileInputStream fileIn = new FileInputStream(path + LibID1 + ".serFS");
org.nustaq_old.serialization.FSTObjectInput in = new org.nustaq_old.serialization.FSTObjectInput(fileIn);
FragmentLibManager FragLib = (FragmentLibManager) in.readObject();
in.close();
fileIn.close();
return FragLib;
} catch (Exception ex) {
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return null;
}
}
示例5: FS_PeakClusterRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private boolean FS_PeakClusterRead() {
if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS").exists()) {
return false;
}
try {
Logger.getRootLogger().info("Reading PeakCluster serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
PeakClusters = (ArrayList<PeakCluster>) in.readObject();
in.close();
fileIn.close();
} catch (Exception ex) {
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
if (FS_PeakClusterRead_Old()) {
WritePeakClusterSerialization();
return true;
}
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return false;
}
return true;
}
示例6: FS_PeakClusterRead_Old
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private boolean FS_PeakClusterRead_Old() {
if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS").exists()) {
return false;
}
try {
Logger.getRootLogger().info("Old PeakCluster serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS");
org.nustaq_old.serialization.FSTObjectInput in = new org.nustaq_old.serialization.FSTObjectInput(fileIn);
PeakClusters = (ArrayList<PeakCluster>) in.readObject();
in.close();
fileIn.close();
} catch (Exception ex) {
Logger.getRootLogger().error("Old version reader still failed.");
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return false;
}
return true;
}
示例7: FSCluster2CurveRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private boolean FSCluster2CurveRead() {
if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS").exists()) {
return false;
}
try {
Logger.getRootLogger().debug("Reading PrecursorFragmentCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
FragmentsClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject();
in.close();
fileIn.close();
} catch (Exception ex) {
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return false;
}
return true;
}
示例8: FSCluster2CurveUnfragRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private boolean FSCluster2CurveUnfragRead() {
if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS").exists()) {
return false;
}
try {
Logger.getRootLogger().debug("Reading UnfragPrecursorFragCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
UnFragIonClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject();
in.close();
fileIn.close();
} catch (Exception ex) {
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return false;
}
return true;
}
示例9: FSScanPosRead
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private boolean FSScanPosRead() {
if (!new File(FilenameUtils.removeExtension(filename) + ".ScanPosFS").exists()) {
return false;
}
try {
Logger.getRootLogger().debug("Reading ScanPos:" + FilenameUtils.removeExtension(filename) + ".ScanPosFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.removeExtension(filename) + ".ScanPosFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
ScanIndex = (TreeMap<Integer, Long>) in.readObject();
TotalScan = ScanIndex.size();
in.close();
fileIn.close();
} catch (Exception ex) {
Logger.getRootLogger().debug("ScanIndex serialization file failed");
//Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return false;
}
return true;
}
示例10: FS_Read
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
private static LCMSID FS_Read(String filepath, String tag) throws Exception {
if (!tag.equals("")) {
tag = "_" + tag;
}
if (!new File(FilenameUtils.getFullPath(filepath) + FilenameUtils.getBaseName(filepath) + tag + "_LCMSID.serFS").exists()) {
return null;
}
try {
Logger.getRootLogger().info("Reading ID results from file:" + FilenameUtils.getFullPath(filepath) + FilenameUtils.getBaseName(filepath) + tag + "_LCMSID.serFS...");
FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(filepath) + FilenameUtils.getBaseName(filepath) + tag + "_LCMSID.serFS");
FSTObjectInput in = new FSTObjectInput(fileIn);
LCMSID lcmsid = (LCMSID) in.readObject(LCMSID.class);
in.close();
fileIn.close();
return lcmsid;
} catch (Exception ex) {
Logger.getRootLogger().info("Reading LCMSID FS results failed.");
Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
return null;
}
}
示例11: 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;
}
示例12: 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;
}
}
示例13: main
import org.nustaq.serialization.FSTObjectInput; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
SomeMediumClass mediumClass = new SomeMediumClass();
byte barray[] = conf.asByteArray(mediumClass);
System.out.println(barray.length);
SomeMediumClass object = (SomeMediumClass)conf.asObject(barray);
System.out.println(object);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
FSTObjectOutput output = new FSTObjectOutput(outputStream);
output.writeObject(mediumClass);
output.close();
FSTObjectInput input = new FSTObjectInput(new ByteArrayInputStream(outputStream.toByteArray()));
object = (SomeMediumClass)input.readObject(SomeMediumClass.class);
System.out.println(object);
}
示例14: 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;
}
示例15: 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;
}