本文整理汇总了Java中de.schlichtherle.truezip.file.TFileInputStream类的典型用法代码示例。如果您正苦于以下问题:Java TFileInputStream类的具体用法?Java TFileInputStream怎么用?Java TFileInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TFileInputStream类属于de.schlichtherle.truezip.file包,在下文中一共展示了TFileInputStream类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkContentsOfFile
import de.schlichtherle.truezip.file.TFileInputStream; //导入依赖的package包/类
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 ) {}
}
}
}
示例2: scan
import de.schlichtherle.truezip.file.TFileInputStream; //导入依赖的package包/类
@Override
public void scan(File file, String filename, ICsvImportFileVisitor<CsvTable, CsvRow, CsvCell, CsvCellReference> visitor) throws TableImportException {
Validate.notNull(file, "file must not be null");
Validate.notNull(visitor, "visitor must not be null");
OpenCsvImportNavigator navigator = new OpenCsvImportNavigator(filename);
try (
InputStream stream = new TFileInputStream(file);
Reader reader = createReader(stream, filename);
CSVReader csvReader = createCsvReader(reader, filename)
) {
CsvTable sheet = new CsvTable(csvReader.readAll());
visitor.visitTable(navigator, sheet);
} catch (IOException e) {
throw new TableImportFileException(e, navigator.getLocation(null, null, null));
}
}
示例3: scan
import de.schlichtherle.truezip.file.TFileInputStream; //导入依赖的package包/类
@Override
public void scan(File file, String filename, SheetSelection selection, IExcelImportFileVisitor<Workbook, Sheet, Row, Cell, CellReference> visitor) throws TableImportException {
Validate.notNull(file, "file must not be null");
Validate.notNull(visitor, "visitor must not be null");
ApachePoiImportNavigator navigator = new ApachePoiImportNavigator(filename);
try (InputStream stream = new TFileInputStream(file)) {
Workbook workbook = WorkbookFactory.create(stream);
for (int index = 0 ; index < workbook.getNumberOfSheets() ; ++index) {
Sheet sheet = workbook.getSheetAt(index);
if (navigator.tableHasContent(sheet) && SELECTIONS_PREDICATES.get(selection).apply(sheet)) {
visitor.visitSheet(navigator, workbook, sheet);
}
}
} catch (InvalidFormatException | IOException | IllegalArgumentException e) {
throw new TableImportFileException(e, navigator.getLocation(null, null, null));
}
}
示例4: importProjects
import de.schlichtherle.truezip.file.TFileInputStream; //导入依赖的package包/类
@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);
}
示例5: internalEqualsOrSameContent
import de.schlichtherle.truezip.file.TFileInputStream; //导入依赖的package包/类
@SuppressWarnings("OverlyComplexMethod")
private static boolean internalEqualsOrSameContent(@Nonnull File fileA, @Nonnull File fileB) throws IOException {
if (fileA.equals(fileB)) {
return true;
}
if (fileA.isFile()) {
if (fileB.isFile()) {
InputStream inputStreamA = null;
InputStream inputStreamB = null;
try {
return fileA.length() == fileB.length() && IoUtil.contentEquals(
inputStreamA = fileA instanceof TFile
? new TFileInputStream(fileA)
: new FileInputStream(fileA),
inputStreamB = fileB instanceof TFile
? new TFileInputStream(fileB)
: new FileInputStream(fileB)
);
} finally {
IoUtil.closeQuietly(inputStreamA, inputStreamB);
}
} else {
return false;
}
}
if (fileA.isDirectory()) {
if (fileB.isDirectory()) {
File[] childrenA = fileA.listFiles();
int childACount = childrenA == null ? 0 : childrenA.length;
if (childACount != ArrayUtils.getLength(fileB.listFiles())) {
return false;
}
for (int childIndex = 0; childIndex < childACount; ++childIndex) {
File childA = childrenA[childIndex];
File childB = fileB instanceof TFile
? new TFile(fileB, childA.getName())
: new File(fileB, childA.getName());
if (!internalEqualsOrSameContent(childA, childB)) {
return false;
}
}
return true;
} else {
return false;
}
}
return false;
}
示例6: importDirectory
import de.schlichtherle.truezip.file.TFileInputStream; //导入依赖的package包/类
@Override
public void importDirectory(File directory) throws ServiceException, SecurityServiceException, FileNotFoundException, IOException {
Map<String, Map<String, GenericEntity<Long, ?>>> idsMapping = new HashMap<String, Map<String, GenericEntity<Long, ?>>>();
importBeforeReferenceData(directory, idsMapping);
LOGGER.info("Importing {}", REFERENCE_DATA_FILE);
Workbook genericListItemWorkbook = new HSSFWorkbook(new TFileInputStream(FileUtils.getFile(directory, REFERENCE_DATA_FILE)));
importGenericListItems(idsMapping, genericListItemWorkbook);
LOGGER.info("Import of {} complete", REFERENCE_DATA_FILE);
importAfterReferenceData(directory, idsMapping);
importBeforeBusinessData(directory, idsMapping);
LOGGER.info("Importing {}", BUSINESS_DATA_FILE);
Workbook businessItemWorkbook = new HSSFWorkbook(new TFileInputStream(FileUtils.getFile(directory, BUSINESS_DATA_FILE)));
importMainBusinessItems(idsMapping, businessItemWorkbook);
LOGGER.info("Import of {} complete", BUSINESS_DATA_FILE);
importAfterBusinessData(directory, idsMapping);
importFiles(directory, idsMapping);
propertyService.set(DATABASE_INITIALIZED, true);
LOGGER.info("Import complete");
}