本文整理汇总了Java中org.embulk.spi.FileOutput类的典型用法代码示例。如果您正苦于以下问题:Java FileOutput类的具体用法?Java FileOutput怎么用?Java FileOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileOutput类属于org.embulk.spi包,在下文中一共展示了FileOutput类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CommonsCompressArchiveProvider
import org.embulk.spi.FileOutput; //导入依赖的package包/类
CommonsCompressArchiveProvider(PluginTask task, FileOutput fileOutput) {
this.format = ArchiveFormat.toArchiveFormat(task.getFormat());
this.underlyingFileOutput = fileOutput;
this.output = new FileOutputOutputStream(fileOutput, task.getBufferAllocator(), FileOutputOutputStream.CloseMode.FLUSH);
this.entryNamePrefix = task.getPrefix();
this.baseNum = baseNumSeq.incrementAndGet();
}
开发者ID:hata,项目名称:embulk-encoder-commons-compress,代码行数:8,代码来源:CommonsCompressArchiveProvider.java
示例2: createProvider
import org.embulk.spi.FileOutput; //导入依赖的package包/类
OutputStreamFileOutput.Provider createProvider(PluginTask task, FileOutput output) {
String format = task.getFormat();
if (CommonsCompressCompressorProvider.isCompressorFormat(format)) {
return new CommonsCompressCompressorProvider(task, output);
} else if (CommonsCompressArchiveProvider.isArchiveFormat(format)) {
return new CommonsCompressArchiveProvider(task, output);
} else {
throw new RuntimeException("Unknown format is set format:" + format);
}
}
开发者ID:hata,项目名称:embulk-encoder-commons-compress,代码行数:11,代码来源:CommonsCompressEncoderPlugin.java
示例3: open
import org.embulk.spi.FileOutput; //导入依赖的package包/类
@Override
public PageOutput open(TaskSource taskSource, final Schema schema, FileOutput output) {
final PluginTask task = taskSource.loadTask(PluginTask.class);
final Sheet sheet = newWorkbook(task);
final FileOutputOutputStream stream = new FileOutputOutputStream(output, task.getBufferAllocator(),
CloseMode.CLOSE);
stream.nextFile();
return new PageOutput() {
private final PageReader pageReader = new PageReader(schema);
@Override
public void add(Page page) {
pageReader.setPage(page);
PoiExcelColumnVisitor visitor = new PoiExcelColumnVisitor(task, schema, sheet, pageReader);
while (pageReader.nextRecord()) {
schema.visitColumns(visitor);
visitor.endRecord();
}
}
@Override
public void finish() {
Workbook book = sheet.getWorkbook();
try (FileOutputOutputStream os = stream) {
book.write(os);
os.finish();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public void close() {
stream.close();
}
};
}
开发者ID:hishidama,项目名称:embulk-formatter-poi_excel,代码行数:41,代码来源:PoiExcelFormatterPlugin.java
示例4: open
import org.embulk.spi.FileOutput; //导入依赖的package包/类
@Override
public PageOutput open(final TaskSource taskSource, final Schema inputSchema,
final FileOutput output)
{
final PluginTask task = taskSource.loadTask(PluginTask.class);
final LineEncoder encoder = new LineEncoder(output, task);
final String nullString = task.getNullString();
final Schema outputSchema = getOutputSchema(task.getColumnKeys(), inputSchema);
encoder.nextFile();
return new PageOutput() {
private final PageReader pageReader = new PageReader(inputSchema);
public void add(Page page)
{
pageReader.setPage(page);
while (pageReader.nextRecord()) {
List<Object> values = Lists.newArrayList();
for (Column column : outputSchema.getColumns()) {
if (pageReader.isNull(column)) {
values.add(nullString);
continue;
}
if (Types.STRING.equals(column.getType())) {
values.add(pageReader.getString(column));
} else if (Types.BOOLEAN.equals(column.getType())) {
values.add(pageReader.getBoolean(column));
} else if (Types.DOUBLE.equals(column.getType())) {
values.add(pageReader.getDouble(column));
} else if (Types.LONG.equals(column.getType())) {
values.add(pageReader.getLong(column));
} else if (Types.TIMESTAMP.equals(column.getType())) {
values.add(pageReader.getTimestamp(column));
} else if (Types.JSON.equals(column.getType())) {
values.add(pageReader.getJson(column));
}
}
logger.debug("record => {}", values);
final String text = String.format(task.getFormat(), (Object[]) values.toArray());
encoder.addText(text);
}
}
public void finish()
{
encoder.finish();
}
public void close()
{
encoder.close();
}
};
}
开发者ID:toyama0919,项目名称:embulk-formatter-sprintf,代码行数:56,代码来源:SprintfFormatterPlugin.java
示例5: open
import org.embulk.spi.FileOutput; //导入依赖的package包/类
@Override
public FileOutput open(TaskSource taskSource, final FileOutput fileOutput) {
PluginTask task = taskSource.loadTask(PluginTask.class);
return new OutputStreamFileOutput(createProvider(task, fileOutput));
}
开发者ID:hata,项目名称:embulk-encoder-commons-compress,代码行数:6,代码来源:CommonsCompressEncoderPlugin.java
示例6: CommonsCompressCompressorProvider
import org.embulk.spi.FileOutput; //导入依赖的package包/类
CommonsCompressCompressorProvider(PluginTask task, FileOutput fileOutput) {
this.format = CompressorFormat.toCompressorFormat(task.getFormat());
this.underlyingFileOutput = fileOutput;
this.output = new FileOutputOutputStream(fileOutput, task.getBufferAllocator(), FileOutputOutputStream.CloseMode.FLUSH);
}
开发者ID:hata,项目名称:embulk-encoder-commons-compress,代码行数:6,代码来源:CommonsCompressCompressorProvider.java
注:本文中的org.embulk.spi.FileOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论