Package com.cloudhopper.smpp.tlv

Examples of com.cloudhopper.smpp.tlv.TlvConvertException


            // create a new byte array with a null byte
            byte[] bytes0 = new byte[bytes.length+1];
            System.arraycopy(bytes, 0, bytes0, 0, bytes.length);
            return new Tlv(tag, bytes0);
        } catch (UnsupportedEncodingException e) {
            throw new TlvConvertException("String", "unsupported charset " + e.getMessage());
        }
    }
View Full Code Here


            }
            // convert the string into a byte array
            byte[] bytes = value.getBytes(charsetName);
            // is this string longer than the fixed length?
            if (bytes.length > fixedLength) {
                throw new TlvConvertException("String", "length exceeds fixed length ["+fixedLength+"]");
            }
            // do we need to pad the string?
            if (bytes.length < fixedLength) {
                 // create a new byte array with a null byte
                byte[] bytes0 = new byte[fixedLength];
                System.arraycopy(bytes, 0, bytes0, 0, bytes.length);
                bytes = bytes0; // use the new array
            }
            return new Tlv(tag, bytes);
        } catch (UnsupportedEncodingException e) {
            throw new TlvConvertException("String", "unsupported charset " + e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of com.cloudhopper.smpp.tlv.TlvConvertException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.