All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aeontronix.enhancedmule.tools.util.FileStreamSource Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha4
Show newest version
/*
 * Copyright (c) Aeontronix 2019
 */

package com.aeontronix.enhancedmule.tools.util;

import java.io.*;

public class FileStreamSource implements StreamSource {
    private File file;

    public FileStreamSource(File file) {
        this.file = file;
        if (!file.exists()) {
            throw new IllegalArgumentException("File doesn't exist: " + file.exists());
        }
    }

    @Override
    public String getFileName() {
        return file.getName();
    }

    @Override
    public InputStream createInputStream() throws IOException {
        try {
            return new FileInputStream(file);
        } catch (FileNotFoundException e) {
            throw new IOException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy