de.schlichtherle.truezip.file.TFileInputStream Java Examples

The following examples show how to use de.schlichtherle.truezip.file.TFileInputStream. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModuleManagementToolTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void checkContentsOfFile(String location, String expectedContents)
    throws IOException
{
    File file = new TFile(location);
    assertTrue(file.exists());  
    BufferedReader reader = null;
    try
    {
        reader = new BufferedReader(new InputStreamReader(new TFileInputStream(file)));
        String line = reader.readLine();
        assertNotNull(line);
        assertEquals(expectedContents, line.trim());
    }
    finally
    {
        if (reader != null)
        {
            try { reader.close(); } catch (Throwable e ) {}
        }
    }
}
 
Example #2
Source File: DBFDataParserTest.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected byte[] getBytes() {
	if (bytes == null) {
		try {
			DBFDataFormatter formatter = new DBFDataFormatter("ISO-8859-1", (byte) 0x02);
			formatter.init(getMetadata());
			File tmpFile = File.createTempFile("DBFDataParserTest", ".tmp");
			formatter.setDataTarget(tmpFile);
			formatter.writeHeader();
			formatter.writeFooter();
			formatter.close();
			ByteArrayOutputStream os = new ByteArrayOutputStream();
			StreamUtils.copy(new TFileInputStream(tmpFile), os, true, true);
			bytes = os.toByteArray();
			if (!tmpFile.delete()) {
				System.err.println("Failed to delete " + tmpFile);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
	return bytes;
}
 
Example #3
Source File: ProjectImportDataServiceImpl.java    From artifact-listener with Apache License 2.0 5 votes vote down vote up
@Override
public void importProjects(File file) throws FileNotFoundException, IOException {
	Map<String, Map<String, GenericEntity<Long, ?>>> idsMapping = new HashMap<String, Map<String, GenericEntity<Long, ?>>>();

	Workbook workbook = new HSSFWorkbook(new TFileInputStream(file));
	doImportItem(idsMapping, workbook, Project.class);
	doImportItem(idsMapping, workbook, ProjectVersion.class);
}