@Test public void testGetHeader() throws Exception { String header = ((BasicCyFileFilter) filter).getHeader(validURI.toURL().openStream(),10); assertNotNull(header); assertTrue(header.contains("xml version=")); }
protected final String getHeader(InputStream stream, int numLines) { String header; BufferedReader br = new BufferedReader(new InputStreamReader(stream)); try { header = parseHeader(br, numLines); } catch (IOException ioe) { logger.warn("failed to read header from stream", ioe); header = ""; } finally { if (br != null) try { br.close(); } catch (IOException e) { } br = null; } return header; }
BasicCyFileFilter implements CyFileFilter { protected final String getHeader(InputStream stream, int numLines) { String header; BufferedReader br = new BufferedReader(new InputStreamReader(stream)); try { header = parseHeader(br, numLines); } catch (IOException ioe) { logger.warn("failed to read header from stream", ioe); header = ""; } finally { if (br != null) try { br.close(); } catch (IOException e) { } br = null; } return header; } }
BasicCyFileFilter implements CyFileFilter { protected final String getHeader(InputStream stream, int numLines) { String header; BufferedReader br = new BufferedReader(new InputStreamReader(stream)); try { header = parseHeader(br, numLines); } catch (IOException ioe) { logger.warn("failed to read header from stream", ioe); header = ""; } finally { if (br != null) try { br.close(); } catch (IOException e) { } br = null; } return header; } BasicCyFileFilter(
			final Set<String> extensions,
			final Set<String> contentTypes,
			final String description,
			final DataCategory category,
			final StreamUtil streamUtil
	);  BasicCyFileFilter(
			final String[] extensions,
			final String[] contentTypes,
			final String description,
			final DataCategory category,
			final StreamUtil streamUtil
	); }
BasicCyFileFilter implements CyFileFilter { protected final String getHeader(InputStream stream, int numLines) { String header; BufferedReader br = new BufferedReader(new InputStreamReader(stream)); try { header = parseHeader(br, numLines); } catch (IOException ioe) { logger.warn("failed to read header from stream", ioe); header = ""; } finally { if (br != null) try { br.close(); } catch (IOException e) { } br = null; } return header; } BasicCyFileFilter(
			final Set<String> extensions,
			final Set<String> contentTypes,
			final String description,
			final DataCategory category,
			final StreamUtil streamUtil
	);  BasicCyFileFilter(
			final String[] extensions,
			final String[] contentTypes,
			final String description,
			final DataCategory category,
			final StreamUtil streamUtil
	); @Override boolean accepts(URI uri, DataCategory category); @Override boolean accepts(InputStream stream, DataCategory category); @Override final Set<String> getExtensions(); @Override final Set<String> getContentTypes(); @Override final String getDescription(); @Override final DataCategory getDataCategory(); @Override String toString(); }
BasicCyFileFilter implements CyFileFilter { protected final String getHeader(InputStream stream, int numLines) { String header; BufferedReader br = new BufferedReader(new InputStreamReader(stream)); try { header = parseHeader(br, numLines); } catch (IOException ioe) { logger.warn("failed to read header from stream", ioe); header = ""; } finally { if (br != null) try { br.close(); } catch (IOException e) { } br = null; } return header; } BasicCyFileFilter(
			final Set<String> extensions,
			final Set<String> contentTypes,
			final String description,
			final DataCategory category,
			final StreamUtil streamUtil
	);  BasicCyFileFilter(
			final String[] extensions,
			final String[] contentTypes,
			final String description,
			final DataCategory category,
			final StreamUtil streamUtil
	); @Override boolean accepts(URI uri, DataCategory category); @Override boolean accepts(InputStream stream, DataCategory category); @Override final Set<String> getExtensions(); @Override final Set<String> getContentTypes(); @Override final String getDescription(); @Override final DataCategory getDataCategory(); @Override String toString();  }