return new String(lpWideCharStr);
StringBuffer buffer = new StringBuffer(new String(lpWideCharStr)); int fragmentStart = 0, fragmentEnd = 0; int start = buffer.indexOf(StartFragment) + StartFragment.length(); int end = start + 1; while (end < buffer.length()) { String s = buffer.substring(start, end); try { fragmentStart = Integer.parseInt(s); end++; } catch (NumberFormatException e) { break; } } start = buffer.indexOf(EndFragment) + EndFragment.length(); end = start + 1; while (end < buffer.length()) { String s = buffer.substring(start, end); try { fragmentEnd = Integer.parseInt(s); end++; } catch (NumberFormatException e) { break; } } if (fragmentEnd <= fragmentStart || fragmentEnd > lpWideCharStr.length) return null;  String s = buffer.substring(fragmentStart, fragmentEnd);  String foxStart = "<!--StartFragment -->\r\n"; int prefix = s.indexOf(foxStart); if (prefix != -1) { prefix += foxStart.length(); s = s.substring(prefix); } return s;
public Object nativeToJava(TransferData transferData){	if (!isSupportedType(transferData) || transferData.pIDataObject == 0) return null;	IDataObject data = new IDataObject(transferData.pIDataObject);	data.AddRef();	STGMEDIUM stgmedium = new STGMEDIUM();	FORMATETC formatetc = transferData.formatetc;	stgmedium.tymed = COM.TYMED_HGLOBAL;		transferData.result = data.GetData(formatetc, stgmedium);	data.Release();		if (transferData.result != COM.S_OK) return null;	int hMem = stgmedium.unionField;	try {		int lpMultiByteStr = OS.GlobalLock(hMem);		if (lpMultiByteStr == 0) return null;		try {			int codePage = OS.GetACP();			int cchWideChar  = OS.MultiByteToWideChar (codePage, OS.MB_PRECOMPOSED, lpMultiByteStr, -1, null, 0);			if (cchWideChar == 0) return null;			char[] lpWideCharStr = new char [cchWideChar - 1];			OS.MultiByteToWideChar (codePage, OS.MB_PRECOMPOSED, lpMultiByteStr, -1, lpWideCharStr, lpWideCharStr.length);			return new String(lpWideCharStr);		} finally {			OS.GlobalUnlock(hMem);		}	} finally {		OS.GlobalFree(hMem);	}}