public int getLength() { return(TransferUtil.getLengthOfBoolean() + TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfShort() + TransferUtil.getLengthOfChar() + TransferUtil.getLengthOfInt() + TransferUtil.getLengthOfLong() + TransferUtil.getLengthOfFloat() + TransferUtil.getLengthOfDouble() + TransferUtil.getLengthOfDate() + TransferUtil.getLengthOfString(allTypeBean.getAstring())); }
public static int getByteArrayLength(Dictionary <String, Int32> intMap) { int blength = 0; foreach (KeyValuePair <String, Int32> item in intMap) { // type blength += TransferUtil.getLengthOfByte(); // key String key = item.Key; blength += TransferUtil.getLengthOfString(key); // value blength += TransferUtil.getLengthOfInt(); } return(blength); }
public void writeWrapper(TransferObjectWrapper v) { if (v == null) { writeNull(); return; } int blength = TransferUtil.getLengthOfString(v.GetType().FullName) + v.getLength(); byte[] byteArray = new byte[TransferUtil.getLengthOfInt() + blength]; TransferOutputStream touts = new TransferOutputStream(byteArray); touts.writeInt(blength); touts.writeString(v.GetType().FullName); v.getByteArray(touts); write(byteArray, 0, byteArray.Length); }
private int getByteArrayLength() { int blength = 0; // length of class, method, returnType and compress flag blength += TransferUtil.getLengthOfString(calleeClass); blength += TransferUtil.getLengthOfString(calleeMethod); blength += TransferUtil.getLengthOfByte(); blength += TransferUtil.getLengthOfByte(); // length of list data foreach (ValueObject vo in paramList) { if (vo.dataType == DATATYPE_BOOLEAN) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfBoolean(); } else if (vo.dataType == DATATYPE_BYTE) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfByte(); } else if (vo.dataType == DATATYPE_SHORT) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfShort(); } else if (vo.dataType == DATATYPE_CHAR) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfChar(); } else if (vo.dataType == DATATYPE_INT) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfInt(); } else if (vo.dataType == DATATYPE_LONG) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfLong(); } else if (vo.dataType == DATATYPE_FLOAT) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfFloat(); } else if (vo.dataType == DATATYPE_DOUBLE) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfDouble(); } else if (vo.dataType == DATATYPE_DATE) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfDate(); } else if (vo.dataType == DATATYPE_STRING) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfString((string)vo.dataObject); } else if (vo.dataType == DATATYPE_BYTEARRAY) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfByteArray((byte[])vo.dataObject); } else if (vo.dataType == DATATYPE_INTARRAY) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfIntArray((int[])vo.dataObject); } else if (vo.dataType == DATATYPE_LONGARRAY) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfLongArray((long[])vo.dataObject); } else if (vo.dataType == DATATYPE_FLOATARRAY) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfFloatArray((float[])vo.dataObject); } else if (vo.dataType == DATATYPE_DOUBLEARRAY) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfDoubleArray((double[])vo.dataObject); } else if (vo.dataType == DATATYPE_STRINGARRAY) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfStringArray((string[])vo.dataObject); } else if (vo.dataType == DATATYPE_WRAPPER) { blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfWrapper((TransferObjectWrapper)vo.dataObject); } } return(blength); }
public override byte[] getByteData() { int blength = getByteArrayLength(); byte[] byteArray = new byte[TransferUtil.getLengthOfInt() + blength]; TransferOutputStream touts = new TransferOutputStream(byteArray); touts.writeInt(blength); touts.writeString(calleeClass); touts.writeString(calleeMethod); touts.writeByte(returnType); touts.writeBoolean(compress); foreach (ValueObject vo in paramList) { if (vo.dataType == DATATYPE_BOOLEAN) { touts.writeByte(DATATYPE_BOOLEAN); touts.writeBoolean((bool)vo.dataObject); } else if (vo.dataType == DATATYPE_BYTE) { touts.writeByte(DATATYPE_BYTE); touts.writeByte((byte)vo.dataObject); } else if (vo.dataType == DATATYPE_SHORT) { touts.writeByte(DATATYPE_SHORT); touts.writeShort((short)vo.dataObject); } else if (vo.dataType == DATATYPE_CHAR) { touts.writeByte(DATATYPE_CHAR); touts.writeChar((char)vo.dataObject); } else if (vo.dataType == DATATYPE_INT) { touts.writeByte(DATATYPE_INT); touts.writeInt((int)vo.dataObject); } else if (vo.dataType == DATATYPE_LONG) { touts.writeByte(DATATYPE_LONG); touts.writeLong((long)vo.dataObject); } else if (vo.dataType == DATATYPE_FLOAT) { touts.writeByte(DATATYPE_FLOAT); touts.writeFloat((float)vo.dataObject); } else if (vo.dataType == DATATYPE_DOUBLE) { touts.writeByte(DATATYPE_DOUBLE); touts.writeDouble((double)vo.dataObject); } else if (vo.dataType == DATATYPE_DATE) { touts.writeByte(DATATYPE_DATE); touts.writeDate((DateTime)vo.dataObject); } else if (vo.dataType == DATATYPE_STRING) { touts.writeByte(DATATYPE_STRING); touts.writeString((string)vo.dataObject); } else if (vo.dataType == DATATYPE_BYTEARRAY) { touts.writeByte(DATATYPE_BYTEARRAY); touts.writeByteArray((byte[])vo.dataObject); } else if (vo.dataType == DATATYPE_INTARRAY) { touts.writeByte(DATATYPE_INTARRAY); touts.writeIntArray((int[])vo.dataObject); } else if (vo.dataType == DATATYPE_LONGARRAY) { touts.writeByte(DATATYPE_LONGARRAY); touts.writeLongArray((long[])vo.dataObject); } else if (vo.dataType == DATATYPE_FLOATARRAY) { touts.writeByte(DATATYPE_FLOATARRAY); touts.writeFloatArray((float[])vo.dataObject); } else if (vo.dataType == DATATYPE_DOUBLEARRAY) { touts.writeByte(DATATYPE_DOUBLEARRAY); touts.writeDoubleArray((double[])vo.dataObject); } else if (vo.dataType == DATATYPE_STRINGARRAY) { touts.writeByte(DATATYPE_STRINGARRAY); touts.writeStringArray((string[])vo.dataObject); } else if (vo.dataType == DATATYPE_WRAPPER) { touts.writeByte(DATATYPE_WRAPPER); touts.writeWrapper((TransferObjectWrapper)vo.dataObject); } } return(byteArray); }
public int getLength() { return(TransferUtil.getLengthOfInt() + TransferUtil.getLengthOfString(account.getName()) + TransferUtil.getLengthOfString(account.getAddress())); }