MspImportAlgorithm { public static @Nonnull MspSpectrum parseMspFromFile(@Nonnull File mspFile) throws IOException, MSDKException { String str = Files.toString(mspFile, Charsets.ISO_8859_1); if (Strings.isNullOrEmpty(str)) throw new IOException("Could not parse content of file " + mspFile); return parseMspFromString(str); }  static @Nonnull MspSpectrum parseMspFromFile(@Nonnull File mspFile); static @Nonnull MspSpectrum parseMspFromString(@Nonnull String mspText);  }
@Test public void testSampleMSP() throws MSDKException, IOException { File inputFile = new File(TEST_DATA_PATH + "sample.msp"); MspSpectrum spectrum = MspImportAlgorithm.parseMspFromFile(inputFile); Assert.assertEquals(new Integer(18), spectrum.getNumberOfDataPoints()); Assert.assertEquals(26.0, spectrum.getMzValues()[0], 0.0000001); Assert.assertEquals(651.0f, spectrum.getIntensityValues()[17], 0.00001); }