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

org.kapott.hbci.manager.HBCIUtilsInternal Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version

/*  $Id: HBCIUtilsInternal.java,v 1.1 2011/05/04 22:37:47 willuhn Exp $

    This file is part of hbci4java
    Copyright (C) 2001-2008  Stefan Palme

    hbci4java is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    hbci4java is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

package org.kapott.hbci.manager;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.MessageFormat;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;

import org.kapott.hbci.callback.HBCICallback;
import org.kapott.hbci.passport.HBCIPassport;

public class HBCIUtilsInternal
{

    public static Properties blzs;
    public static Map banks = null;
    public static Hashtable  callbacks;  // threadgroup->callbackObject
    public static Hashtable  locMsgs;    // threadgroup->resourceBundle
    public static Hashtable  locales;    // threadgroup->Locale
    
    public static String bigDecimal2String(BigDecimal value)
    {
        DecimalFormat format=new DecimalFormat("0.##");
        DecimalFormatSymbols symbols=format.getDecimalFormatSymbols();
        symbols.setDecimalSeparator('.');
        format.setDecimalFormatSymbols(symbols);
        format.setDecimalSeparatorAlwaysShown(false);
        return format.format(value);
    }

    /**
     * Liefert die Zeile aus der blz.properties mit der angegebenen BLZ.
     * @param blz die BLZ.
     * @return die Zeile aus der blz.properties
     * @deprecated Bitte {@link HBCIUtils#getBankInfo(String)} verwenden.
     */
    public static String getBLZData(String blz)
    {
        return blz!=null?blzs.getProperty(blz,"|||||"):"|||||";
    }

    /**
     * Liefert den n-ten Datensatz (beginnend bei 1) aus der Zeile.
     * @param st die Zeile.
     * @param idx der Index, beginnend bei 1.
     * @return der Wert oder Leerstring.
     * @deprecated Bitte {@link HBCIUtils#getBankInfo(String)} verwenden.
     */
    public static String getNthToken(String st,int idx)
    {
        String[] parts=st.split("\\|");
        String   ret=null;
        
        if ((idx-1)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy