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

org.jrimum.texgit.Texgit Maven / Gradle / Ivy

Go to download

This is a fork and merge from JRimum ( http://www.jrimum.org ), - Bopepo: https://github.com/jrimum/bopepo - Texgit: https://github.com/jrimum/texgit - Valia: https://github.com/jrimum/vallia - Utilix: https://github.com/jrimum/utilix - Domkee: https://github.com/jrimum/domkee For Brazillian Boleto Payment Method. So much thanks for original authors: Gilmar P. S. L, Misael Barreto and Rômulo Augusto.

The newest version!
/*
 * Copyright 2008 JRimum Project
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
 * applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 * 
 * Created at: 26/07/2008 - 12:44:41
 * 
 * ================================================================================
 * 
 * Direitos autorais 2008 JRimum Project
 * 
 * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
 * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
 * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
 * haja exigência legal ou acordo por escrito, a distribuição de software sob
 * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
 * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
 * reger permissões e limitações sob esta LICENÇA.
 * 
 * Criado em: 26/07/2008 - 12:44:41
 * 
 */
package org.jrimum.texgit;

import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.jrimum.utilix.Objects.isNotNull;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;

/**
 * @author Gilmar P.S.L.
 *
 */
public final class Texgit {

    public static final IFlatFile createFlatFile(String xmlDefFilePath)
            throws TexgitException {

        try {

            if (isNotBlank(xmlDefFilePath)) {
                return createFlatFile(new File(xmlDefFilePath));
            }

        } catch (Exception e) {
            throw new TexgitException(e);
        }

        return null;
    }

    public static final IFlatFile createFlatFile(File xmlDefFile)
            throws TexgitException {

        try {

            if (isNotNull(xmlDefFile)) {

                return createFlatFile(new FileInputStream(xmlDefFile));
            }

        } catch (Exception e) {
            throw new TexgitException(e);
        }

        return null;
    }

    public static final IFlatFile createFlatFile(URL xmlDefUrl)
            throws TexgitException {

        try {

            if (isNotNull(xmlDefUrl)) {

                return TexgitManager.buildFlatFile(xmlDefUrl.openStream());
            }

        } catch (Exception e) {
            throw new TexgitException(e);
        }

        return null;
    }

    public static final IFlatFile createFlatFile(byte[] xmlDefBytes)
            throws TexgitException {

        try {

            if (isNotNull(xmlDefBytes)) {

                return TexgitManager.buildFlatFile(new ByteArrayInputStream(xmlDefBytes));
            }

        } catch (Exception e) {
            throw new TexgitException(e);
        }

        return null;
    }

    public static final IFlatFile createFlatFile(InputStream xmlDefStream)
            throws TexgitException {

        if (isNotNull(xmlDefStream)) {

            return TexgitManager.buildFlatFile(xmlDefStream);
        }

        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy