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


Java FSTObjectInput.readObject方法代码示例

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


在下文中一共展示了FSTObjectInput.readObject方法的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;
    }
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:20,代码来源:TargetMatchScoring.java

示例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;
    }
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:21,代码来源:FastaParser.java

示例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;
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:19,代码来源:FragmentLibManager.java

示例4: 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;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:24,代码来源:LCMSPeakBase.java

示例5: 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;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:19,代码来源:LCMSPeakDIAMS2.java

示例6: 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;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:19,代码来源:LCMSPeakDIAMS2.java

示例7: 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;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:21,代码来源:mzXMLParser.java

示例8: 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;
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:24,代码来源:LCMSID.java

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

示例10: 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);
}
 
开发者ID:chuidiang,项目名称:chuidiang-ejemplos,代码行数:20,代码来源:FstExample.java

示例11: testStreamReuse

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Test
public void testStreamReuse() throws Exception {
    FSTConfiguration configuration = FSTConfiguration.createDefaultConfiguration();

    String expected = "Hello, World!";
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FSTObjectOutput fstObjectOutput = configuration.getObjectOutput(baos);
    try {
        fstObjectOutput.writeObject(expected);
    } finally {
        fstObjectOutput.flush();
    }
    byte[] serializedData = baos.toByteArray();
    FSTObjectInput input = configuration.getObjectInput(new ByteArrayInputStream(serializedData));
    Object read = input.readObject();
    Assert.assertEquals(expected, read);

    FSTObjectInput secondInput = configuration.getObjectInput(new ByteArrayInputStream(new byte[0]));
    expectedException.expect(IOException.class);
    expectedException.expectMessage("Failed to read");
    secondInput.readObject();
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:23,代码来源:BasicReuseTest.java

示例12: test

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Test
@Ignore
public void test() throws Throwable {
    FSTConfiguration fc = FSTConfiguration.createDefaultConfiguration();

    byte[] b;
    int len;
    try (FSTObjectOutput foo = new FSTObjectOutput(fc)) {
        foo.writeObject(new Outer());
        b = foo.getBuffer();
        len = foo.getWritten();
    }
    ByteArrayInputStream bais = new ByteArrayInputStream(b, 0, len);
    FSTObjectInput foi = fc.getObjectInput(bais);
    foi.readObject();
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:17,代码来源:OverflowTest.java

示例13: testReadResolve

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Test
public void testReadResolve() throws Exception {
    FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();

    Holder holder = new Holder();
    holder.o = new ToRead("foo");
    holder.o2 = holder.o;

    byte[] b = null;
    FSTObjectOutput out = new FSTObjectOutput(conf);
    out.writeObject(holder);
    out.flush();
    b = out.getBuffer();

    FSTObjectInput in = new FSTObjectInput(conf);
    in.resetForReuseUseArray(b,b.length);
    Object res = in.readObject();

    checkEquals(Holder.class, res.getClass());
    checkEquals(String.class, ((Holder) res).o.getClass());
    checkEquals("foo", ((Holder) res).o);

    checkEquals(String.class, ((Holder) res).o2.getClass());
    checkEquals("foo", ((Holder) res).o2);
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:26,代码来源:ReadResolve.java

示例14: testHM

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Test
public void testHM() throws IOException, ClassNotFoundException {
    FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
    HashMap hm = createHM();
    HashMap hm1 = createHM1(hm);
    FSTObjectOutput oo = conf.getObjectOutput();
    oo.writeObject(hm);
    oo.writeObject(hm1);
    byte[] copyOfWrittenBuffer = oo.getCopyOfWrittenBuffer();

    FSTObjectInput in = conf.getObjectInput(copyOfWrittenBuffer);
    Object o1 = in.readObject();
    Object o2 = in.readObject();
    Assert.assertTrue(DeepEquals.deepEquals(o1,hm));
    Assert.assertTrue(DeepEquals.deepEquals(o2,hm1));
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:17,代码来源:BigObjTest.java

示例15: testWithStreams

import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Test
public void testWithStreams() throws IOException, ClassNotFoundException {
    HashMap hm = createHM();
    HashMap hm1 = createHM1(hm);

    FSTObjectOutput out = new FSTObjectOutput(new FileOutputStream("../epsis.oos"));
    out.writeObject(hm);
    out.writeObject(hm1);
    out.close();

    FSTObjectInput in = new FSTObjectInput(new FileInputStream("../epsis.oos"));
    HashMap o1 = (HashMap) in.readObject();
    HashMap o2 = (HashMap) in.readObject();
    in.close();
    Assert.assertTrue(DeepEquals.deepEquals(o1, hm));
    Assert.assertTrue(DeepEquals.deepEquals(o2, hm1));
}
 
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:18,代码来源:BigObjTest.java


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