1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
/*
========== licence begin GPL
Copyright (C) 2002-2003 SAP AG
This program 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.
This program 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.
========== licence end
*/
package com.sap.dbtech.jdbc.packet;
import com.sap.dbtech.util.UnicodeUtil;
import com.sap.dbtech.vsp00.Vsp00Const;
import com.sap.dbtech.jdbc.translators.ConversionExceptionSapDB;
import com.sap.dbtech.rte.comm.RteC;
/**
*
*/
public class RequestPacketUnicode
extends RequestPacket
{
/**
* creates a new RequestPacketUnicode
*/
public
RequestPacketUnicode (com.sap.dbtech.util.StructuredMem rawPacket, String applID, String applVers)
{
super (rawPacket, RteC.unicodeClient_C, applID, applVers);
}
/**
*
* @param data String
*/
public void addDataString (String data) {
this.mem.putInt1 (Vsp00Const.definedUnicode_C, this.dataPos ());
++this.partLength;
this.addString (data);
}
public void addStringThrowExc (String data) throws ConversionExceptionSapDB{
this.addString(data);
}
/**
*
* @param bytes byte[]
*/
public void addString (String data) {
char [] chars = data.toCharArray ();
int lenInBytes = chars.length * UnicodeUtil.CharWidthC;
this.mem.putBigUnicode(chars, this.dataPos (), lenInBytes);
this.partLength += lenInBytes;
}
/**
*
* @param value java.lang.String
* @param offset int
*/
public int putString (
String value,
int offset)
{
return this.putString (value, offset, value.length ());
}
/**
*
* @return int
* @param value java.lang.String
* @param offset int
* @param len int
*/
public int putString (
String value,
int offset,
int len)
{
char [] chars = value.toCharArray ();
int lenInBytes = UnicodeUtil.CharWidthC;
this.mem.putBigUnicode(chars, offset, len);
return lenInBytes;
}
public boolean isUnicodePacket(){
return true;
}
}
|