亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? isofilledstringfieldpackager.java

?? java pos,你可以直接編譯運行,
?? JAVA
字號:
/*
 * Copyright (c) 2000 jPOS.org.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *    "This product includes software developed by the jPOS project 
 *    (http://www.jpos.org/)". Alternately, this acknowledgment may 
 *    appear in the software itself, if and wherever such third-party 
 *    acknowledgments normally appear.
 *
 * 4. The names "jPOS" and "jPOS.org" must not be used to endorse 
 *    or promote products derived from this software without prior 
 *    written permission. For written permission, please contact 
 *    license@jpos.org.
 *
 * 5. Products derived from this software may not be called "jPOS",
 *    nor may "jPOS" appear in their name, without prior written
 *    permission of the jPOS project.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
 * IN NO EVENT SHALL THE JPOS PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR 
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the jPOS Project.  For more
 * information please see <http://www.jpos.org/>.
 */
package org.jpos.iso;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author joconnor
 * @version $Revision: 1.1 $ $Date: 2003/11/17 11:58:14 $
 */
public class ISOFilledStringFieldPackager extends ISOFieldPackager
{
    private Interpreter interpreter;
    private Padder padder;
    private Prefixer prefixer;

    /**
     * Constructs a default ISOFilledStringFieldPackager. There is no padding,
     * no length prefix and a literal interpretation. The set methods must be called to
     * make this useful.
     */
    public ISOFilledStringFieldPackager()
    {
        super();
        this.padder = NullPadder.INSTANCE;
        this.interpreter = LiteralInterpreter.INSTANCE;
        this.prefixer = NullPrefixer.INSTANCE;
    }

    /**
     * Constructs an ISOFilledStringFieldPackager with a specific Padder, Interpreter and Prefixer.
     * The length and description should be set with setLength() and setDescription methods.
     * @param padder The type of padding used.
     * @param interpreter The interpreter used to encode the field.
     * @param prefixer The type of length prefixer used to encode this field.
     */
    public ISOFilledStringFieldPackager(Padder padder, Interpreter interpreter, Prefixer prefixer)
    {
        super();
        this.padder = padder;
        this.interpreter = interpreter;
        this.prefixer = prefixer;
    }

    /**
     * Creates an ISOFilledStringFieldPackager.
     * @param maxLength The maximum length of the field in characters or bytes depending on the datatype.
     * @param description The description of the field. For human readable output.
     * @param interpreter The interpreter used to encode the field.
     * @param padder The type of padding used.
     * @param prefixer The type of length prefixer used to encode this field.
     */
    public ISOFilledStringFieldPackager(int maxLength, String description, Padder padder,
                                  Interpreter interpreter, Prefixer prefixer)
    {
        super(maxLength, description);
        this.padder = padder;
        this.interpreter = interpreter;
        this.prefixer = prefixer;
    }

    /**
     * Sets the Padder.
     * @param padder The padder to use during packing and unpacking.
     */
    public void setPadder(Padder padder)
    {
        this.padder = padder;
    }

    /**
     * Sets the Interpreter.
     * @param interpreter The interpreter to use in packing and unpacking.
     */
    public void setInterpreter(Interpreter interpreter)
    {
        this.interpreter = interpreter;
    }

    /**
     * Sets the length prefixer.
     * @param prefixer The length prefixer to use during packing and unpacking.
     */
    public void setPrefixer(Prefixer prefixer)
    {
        this.prefixer = prefixer;
    }

    /**
     * Returns the prefixer's packed length and the interpreter's packed length.
	 * @see org.jpos.iso.ISOFieldPackager#getMaxPackedLength()
	 */
    public int getMaxPackedLength()
    {
        return prefixer.getPackedLength() + interpreter.getPackedLength(getLength());
    }

    /** Create a nice readable message for errors */
    private String makeExceptionMessage(ISOComponent c, String operation) {
        Object fieldKey = "unknown";
        if (c != null)
        {
            try
            {
                fieldKey = c.getKey();
            } catch (Exception ignore)
            {
            }
        }
        return this.getClass().getName() + ": Problem " + operation + " field " + fieldKey;
    }

    /**
	 * Convert the component into a byte[].
	 */
    public byte[] pack(ISOComponent c) throws ISOException
    {
        try
        {
            String data = (String)c.getValue();
            if (data.length() > getLength())
            {
                throw new ISOException("Field length " + data.length() + " too long. Max: " + getLength());
            }
            String paddedData = padder.pad(data, getLength());
            byte[] rawData = new byte[prefixer.getPackedLength()
                    + interpreter.getPackedLength(paddedData.length())];
            prefixer.encodeLength(data.length(), rawData);
            interpreter.interpret(paddedData, rawData, prefixer.getPackedLength());
            return rawData;
        } catch(Exception e)
        {
            throw new ISOException(makeExceptionMessage(c, "packing"), e);
        }
    }

    /**
     * Unpacks the byte array into the component.
     * @param c The component to unpack into.
     * @param b The byte array to unpack.
     * @param offset The index in the byte array to start unpacking from.
     * @return The number of bytes consumed unpacking the component.
     */
    public int unpack(ISOComponent c, byte[] b, int offset) throws ISOException
    {
        try
        {
            int len = prefixer.decodeLength(b, offset);
            if (len == -1)
            {
                // The prefixer doesn't know how long the field is, so use
    			// maxLength instead
                len = getLength();
            }
            int lenLen = prefixer.getPackedLength();
            String unpacked = interpreter.uninterpret(b, offset + lenLen, len);
            c.setValue(unpacked);
            return lenLen + interpreter.getPackedLength(getLength());
        } catch(Exception e)
        {
            throw new ISOException(makeExceptionMessage(c, "unpacking"), e);
        }
    }

    /**
     * Unpack the input stream into the component.
     * @param c  The Component to unpack into.
     * @param in Input stream where the packed bytes come from.
     * @exception IOException Thrown if there's a problem reading the input stream.
     */
    public void unpack (ISOComponent c, InputStream in) 
        throws IOException, ISOException
    {
        try
        {
            int lenLen = prefixer.getPackedLength ();
            int len;
            if (lenLen == 0)
            {
                len = getLength();
            } else
            {
                len = prefixer.decodeLength (readBytes (in, lenLen), 0);
            }
            int packedLen = interpreter.getPackedLength(len);
            String unpacked = interpreter.uninterpret(readBytes (in, packedLen), 0, len);
            c.setValue(unpacked);
            in.skip(interpreter.getPackedLength(getLength()) - packedLen);
        } catch(ISOException e)
        {
            throw new ISOException(makeExceptionMessage(c, "unpacking"), e);
        }
    }

    /**
     * Checks the length of the data against the maximum, and throws an IllegalArgumentException.
     * This is designed to be called from field Packager constructors and the setLength()
     * method.
     * @param len The length of the data for this field packager.
     * @param maxLength The maximum length allowed for this type of field packager.
     *          This depends on the prefixer that is used.
     * @throws IllegalArgumentException If len > maxLength.
     */
    protected void checkLength(int len, int maxLength) throws IllegalArgumentException
    {
        if (len > maxLength)
        {
            throw new IllegalArgumentException("Length " + len + " too long for " + getClass().getName());
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
菠萝蜜视频在线观看一区| 久久久激情视频| 久久久91精品国产一区二区精品| 一卡二卡欧美日韩| 琪琪一区二区三区| 欧洲在线/亚洲| 久久久国产午夜精品| 亚洲h精品动漫在线观看| 国产福利一区二区三区在线视频| 欧美亚一区二区| 亚洲欧洲国产日韩| 国产精品一二三区| 91精品国产欧美日韩| 最新国产精品久久精品| 国产一区二区三区在线观看精品| 欧美日韩国产综合草草| 中文在线资源观看网站视频免费不卡 | 日韩欧美激情在线| 中文成人综合网| 日本视频免费一区| 欧美亚洲愉拍一区二区| 欧美国产激情一区二区三区蜜月| 亚洲青青青在线视频| 国产福利一区在线| 日韩三级免费观看| 男女视频一区二区| 6080亚洲精品一区二区| 亚洲成av人片一区二区三区| 色国产综合视频| 亚洲老司机在线| 91久久线看在观草草青青| 中文字幕一区不卡| 色综合夜色一区| 一区二区三区在线观看网站| 色综合久久天天| 亚洲综合丁香婷婷六月香| 一本色道久久综合亚洲aⅴ蜜桃 | 91精品国产福利| 日本不卡在线视频| 欧美xingq一区二区| 免费成人你懂的| 久久久久久日产精品| 成人深夜福利app| 亚洲人成精品久久久久久| 欧美在线视频不卡| 捆绑变态av一区二区三区| 欧美va在线播放| 国产精品原创巨作av| 中文字幕在线播放不卡一区| 日本福利一区二区| 男女激情视频一区| 国产欧美综合在线观看第十页| 大尺度一区二区| 一区二区三区电影在线播| 欧美人xxxx| 懂色av一区二区在线播放| 亚洲视频免费看| 日韩欧美综合一区| 风间由美一区二区三区在线观看| 国产精品乱码人人做人人爱| 91麻豆成人久久精品二区三区| 午夜影视日本亚洲欧洲精品| 精品久久久久久久人人人人传媒 | 久久99国产精品久久99果冻传媒| 国产视频一区不卡| 欧美日本高清视频在线观看| 久久精品国产精品亚洲红杏| 中文字幕制服丝袜成人av| 欧美日韩亚洲不卡| 国产91丝袜在线播放九色| 一区二区三区国产| 久久精品视频在线看| 在线精品视频免费播放| 国模无码大尺度一区二区三区| 亚洲男同1069视频| 欧美精品一区二区在线播放| 色综合欧美在线视频区| 国产一区二区在线电影| 亚洲高清一区二区三区| 中文字幕免费不卡| 精品久久久久av影院| 欧美日韩在线电影| 不卡视频一二三四| 日韩激情av在线| 亚洲精品少妇30p| 欧美极品美女视频| 精品奇米国产一区二区三区| 91福利社在线观看| www.欧美日韩| 国产麻豆欧美日韩一区| 视频一区二区中文字幕| 亚洲精品第1页| 欧美韩日一区二区三区四区| 欧美电影精品一区二区| 51精品视频一区二区三区| 欧美亚洲动漫另类| 色播五月激情综合网| 成人h精品动漫一区二区三区| 精品一区二区三区免费| 蜜臀av性久久久久蜜臀aⅴ | 亚洲精品国产视频| 国产精品福利电影一区二区三区四区| 精品成人一区二区三区| 日韩免费电影一区| 日韩欧美国产一区二区三区| 欧美日韩免费高清一区色橹橹| jlzzjlzz亚洲日本少妇| 成人深夜视频在线观看| 成人激情动漫在线观看| 成人精品一区二区三区中文字幕| 国产精品正在播放| 国产福利精品一区| 成人午夜看片网址| 91网上在线视频| 日本乱码高清不卡字幕| 欧洲一区二区三区在线| 欧美日韩久久一区二区| 欧美放荡的少妇| 日韩欧美专区在线| 久久综合色8888| 国产欧美精品区一区二区三区 | 丁香一区二区三区| jizz一区二区| 在线观看亚洲精品视频| 欧美视频在线一区二区三区 | 7777精品伊人久久久大香线蕉经典版下载| 在线免费精品视频| 欧美精品乱码久久久久久按摩| 欧美日韩高清一区二区三区| 日韩一区二区三区免费观看| www久久久久| 亚洲黄色在线视频| 日本va欧美va瓶| 国产aⅴ精品一区二区三区色成熟| 国产成人在线看| 在线视频你懂得一区| 日韩欧美久久久| 欧美激情一区二区三区在线| 亚洲国产成人精品视频| 日本成人在线电影网| 豆国产96在线|亚洲| 在线亚洲高清视频| 亚洲精品在线观| 亚洲精品老司机| 精彩视频一区二区| 不卡在线视频中文字幕| 欧美网站大全在线观看| 欧美精品一区二区高清在线观看 | 色综合天天做天天爱| 欧美肥妇毛茸茸| 国产精品三级av在线播放| 午夜久久久影院| 国产91在线观看| 欧美一区二区三区在线观看 | 久久久久久久综合色一本| 亚洲色图在线视频| 精品一区二区在线看| 91美女片黄在线观看91美女| 日韩欧美一区二区在线视频| 中文字幕综合网| 九九九精品视频| 欧美日韩夫妻久久| 亚洲欧美综合色| 国产美女在线观看一区| 欧美日韩精品一区二区| 综合久久久久综合| 国产成人一级电影| 91精品国产综合久久婷婷香蕉| 日韩一区在线播放| 国产精品中文字幕日韩精品| 欧美精三区欧美精三区| 亚洲欧美日韩小说| 成人h版在线观看| 久久久久久久久久电影| 美女视频一区二区| 欧美日韩黄色影视| 一卡二卡三卡日韩欧美| 不卡一区在线观看| 久久久久久久久久电影| 麻豆精品一区二区| 91精品国产入口在线| 亚洲18女电影在线观看| 91视视频在线观看入口直接观看www | 国产亚洲精品免费| 美女在线视频一区| 欧美性色aⅴ视频一区日韩精品| 国产精品免费视频观看| 国产精品综合久久| 精品第一国产综合精品aⅴ| 免费在线看成人av| 欧美一区二区三区免费大片| 婷婷亚洲久悠悠色悠在线播放| 欧美在线一二三| 一区二区三区成人| 欧美性大战久久久久久久蜜臀| 亚洲久草在线视频| 日本电影欧美片| 亚洲444eee在线观看| 91超碰这里只有精品国产| 日本91福利区|