当前位置: 首页>>代码示例>>Java>>正文


Java FileInput.nextFile方法代码示例

本文整理汇总了Java中org.embulk.spi.FileInput.nextFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileInput.nextFile方法的具体用法?Java FileInput.nextFile怎么用?Java FileInput.nextFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.embulk.spi.FileInput的用法示例。


在下文中一共展示了FileInput.nextFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOpenForNoFile

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForNoFile(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("sample_0.tar");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    Assert.assertFalse("Verify there is no file.", archiveFileInput.nextFile());
    archiveFileInput.close();

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:23,代码来源:TestCommonsCompressDecoderPlugin.java

示例2: testOpenForOneFile

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForOneFile(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("sample_1.tar");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    verifyContents(archiveFileInput, "1,foo");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例3: testOpenForTwoFiles

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTwoFiles(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("samples.tar");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    verifyContents(archiveFileInput, "1,foo", "2,bar");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例4: testOpenForFourFiles

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForFourFiles(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "zip";
        input.nextFile(); result = true; result = true; result = false; // two files.
        input.poll(); result = getResourceAsBuffer("samples.zip"); result = getResourceAsBuffer("samples.zip");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    verifyContents(archiveFileInput, "1,foo", "2,bar", "1,foo", "2,bar");

    new Verifications() {{
        input.nextFile(); times = 3;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例5: testOpenArchiveFormatAutoDetect

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenArchiveFormatAutoDetect(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("sample_1.tar");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    verifyContents(archiveFileInput, "1,foo");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例6: testOpenForTGZFormat

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTGZFormat(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tgz";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("samples.tgz");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    verifyContents(archiveFileInput, "1,foo", "2,bar");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例7: testOpenForTarGZFormat

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTarGZFormat(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar.gz";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("samples.tar.gz");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);

    verifyContents(archiveFileInput, "1,foo", "2,bar");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例8: testOpenForTarBZ2Format

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTarBZ2Format(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar.bz2";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("samples.tar.bz2");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);
    
    verifyContents(archiveFileInput, "1,foo", "2,bar");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例9: testOpenForTarZFormat

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTarZFormat(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar.Z";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("samples.tar.Z");
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);
    
    verifyContents(archiveFileInput, "1,foo", "2,bar");

    new Verifications() {{
        input.nextFile(); times = 2;
        input.close(); times = 1;
    }};
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:22,代码来源:TestCommonsCompressDecoderPlugin.java

示例10: run

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Override
public void run(TaskSource taskSource, Schema schema,
        FileInput input, PageOutput output)
{
    PluginTask task = taskSource.loadTask(PluginTask.class);
    LineDecoder lineDecoder = new LineDecoder(input,task);
    PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output);
    String line = null;
    final String columnName = task.getColumnName();

    while( input.nextFile() ){
        while(true){
          line = lineDecoder.poll();

          if( line == null ){
              break;
          }

          pageBuilder.setString(0, line);
          pageBuilder.addRecord();
        }
    }
    pageBuilder.finish();
}
 
开发者ID:sonots,项目名称:embulk-parser-none,代码行数:25,代码来源:NoneParserPlugin.java

示例11: testOpenAutoDetectFailed

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test(expected=RuntimeException.class)
public void testOpenAutoDetectFailed(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("sample_1.csv"); // This is not an archive.
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);
    archiveFileInput.nextFile();
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:16,代码来源:TestCommonsCompressDecoderPlugin.java

示例12: testOpenExplicitConfigFailed

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test(expected=RuntimeException.class)
public void testOpenExplicitConfigFailed(@Mocked final FileInput input) throws Exception
{
    new NonStrictExpectations() {{
        taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
        task.getFormat(); result = "tar";
        input.nextFile(); result = true; result = false;
        input.poll(); result = getResourceAsBuffer("samples.zip"); // This is not tar file.
        task.getBufferAllocator(); result = newBufferAllocator();
    }};

    CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
    FileInput archiveFileInput = plugin.open(taskSource, input);
    archiveFileInput.nextFile();
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:16,代码来源:TestCommonsCompressDecoderPlugin.java


注:本文中的org.embulk.spi.FileInput.nextFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。