本文整理汇总了Java中org.nustaq.serialization.FSTObjectInput.close方法的典型用法代码示例。如果您正苦于以下问题:Java FSTObjectInput.close方法的具体用法?Java FSTObjectInput.close怎么用?Java FSTObjectInput.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nustaq.serialization.FSTObjectInput
的用法示例。
在下文中一共展示了FSTObjectInput.close方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例9: 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));
}
示例10: readFromFileFSTObject
import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
/**
* Reads a cache block from disk using FST object streams
*
* @param fileNumber The file number to read from
* @param cacheSpot The block to write to disk
* @param arrayList The BigArrayList
* @throws IOException For I/O errors
* @throws ClassNotFoundException If no such class exists
*/
@SuppressWarnings("unchecked")
protected void readFromFileFSTObject(int fileNumber, int cacheSpot, BigArrayList<E> arrayList) throws IOException, ClassNotFoundException
{
String filePath = memoryPath + File.separator + memoryInstance + "_memory_" + fileNumber + memoryExtension;
File file = new File(filePath);
if(file.exists())
{
FileInputStream fileInputStream = new FileInputStream(filePath);
FSTObjectInput fstObjectInputStream = new FSTObjectInput(fileInputStream);
try
{
arrayList.setList(cacheSpot, (ArrayList<E>)fstObjectInputStream.readObject());
}
catch(IOException ioe)
{
throw ioe;
}
catch (ClassNotFoundException ce)
{
throw ce;
}
finally
{
//need to close both streams, I think this is a java bug
//expected behavior = closing the fstObjectInputStream would also close the fileInputStream, but it does not
//Consequence = unable to delete files
fileInputStream.close();
fstObjectInputStream.close();
}
}
else
{
arrayList.setList(cacheSpot, new ArrayList<E>());
}
}
示例11: thereAndBack
import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
public Collection thereAndBack(Collection data) throws Exception {
byte[] buf = cfg.asByteArray(data);
System.out.println(new String(buf));
FSTObjectInput objectInput = new FSTObjectInput(new ByteArrayInputStream(buf));
Collection list = (Collection) objectInput.readObject();
objectInput.close();
return list;
}
示例12: testMapWriteReplace
import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Test
public void testMapWriteReplace() throws Exception {
Map<String, Object> map = new MyMap<>();
map.put("value", 1234.5);
Map<String, Object> map1 = new MyMap<>();
map1.put("othervalue", 5678.9);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
FSTObjectOutput out = new FSTObjectOutput(buf, getTestConfiguration());
out.writeObject(map);
out.writeObject(map1);
out.writeObject("Ensure Stream is not corrupted");
out.close();
FSTObjectInput in = getTestConfiguration().getObjectInput(new ByteArrayInputStream(buf.toByteArray()));
Map<?, ?> res = (Map<?, ?>) in.readObject();
Map<?, ?> res1 = (Map<?, ?>) in.readObject();
in.close();
assertEquals(LinkedHashMap.class, res.getClass());
assertEquals(1, res.size());
assertEquals(1234.5, res.get("value"));
assertEquals(LinkedHashMap.class, res1.getClass());
assertEquals(1, res1.size());
assertEquals(5678.9, res1.get("othervalue"));
}