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


Java FileInput.close方法代码示例

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


在下文中一共展示了FileInput.close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: verifyContents

import org.embulk.spi.FileInput; //导入方法依赖的package包/类
private void verifyContents(FileInput input, String ...contents) throws IOException {
    for (String expected : contents) {
        Assert.assertTrue("Verify a file can be read.", input.nextFile());
        String text = readFileInput(input);
        Assert.assertEquals("Verify a file read correctly. text:" + text, expected, text);
    }
    Assert.assertFalse("Verify there is no file.", input.nextFile());
    input.close();
}
 
开发者ID:hata,项目名称:embulk-decoder-commons-compress,代码行数:10,代码来源:TestCommonsCompressDecoderPlugin.java


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