用Java代码把URL转成PDF

有没有使用Java代码把URL转成PDF的逻辑代码,还请各位大神指导

1个回答

URL转成PDF是什么意思,把网页抓取下来转换成pdf么?是特定的网页么,还是任意的网页?

Mr_yuanbin
Mr_yuanbin 你这边有处理的方法吗
一年多之前 回复
Mr_yuanbin
Mr_yuanbin 你好 URL转pdf 是特定网页
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
URL转成PDF的微服务
URL转成PDF的微服务,提供一个将Web页面转成PDF的API
把HTML转成PDF
依赖jar包:fonts.jar pd4ml.jar ss_css2.jar PD4ML实现html2pdf,速度快,纠错能力强,支持多种中文字体。相比较于IText和Flying Sauser方便许多
用什么方法把Excel表格转成PDF
不知道大家有没有发现,现在有很多的文件上传的过程中都要以PDF的格式发送,又会限制PDF格式的大小,一般情况下,在遇到这样的情况,就需要把PDF文件进行压缩处理,至于怎么压缩PDF文件的话,可以用PDF转换器。 操作工具:迅捷PDF转换器 1、这里先不用着急进入到压缩的过程,可以选择操作的电脑中将需要压缩文件保存在桌面上,文件过多的话可以选择将文件保存在一个文件夹中,便于操作。 2、这里就不多...
用java把word转成pdf
问问各位大哥大姐 怎么用java把word转成pdf, 还有用java操纵word 获得word中的数据
如何把Kotlin代码转成Java代码、把Java代码转成Kotlin代码
Java转Kotlin打开File –> Settings –> Plugins选项,输入“Kotlin”搜索插件,安装成功重启Android Studio 选中需要转换的文件或者包 Code –> Convert Java File To Kotlin File 注意:Convert Java File To Kotlin File为灰色的几种情况 Kotlin插件未安装 选中的文件已是kot
如何把Kotlin代码转成java代码,如何把java代码转成kotlin代码
其实就是互转,以下基于IDEA或Android StudioJava转Kotlin打开要转的文件方法1Ctrl+Shift+Alt+K方法2Code - Convert Java File To Kotlin FileKotlikn 转 Java Tools>Kotlin>Show Kotlin Bytecode Decompile
求把这段JAVA代码转成C#的,谢谢!
[code=Java]rnString apikey = "111111111111111111111111111111"; rnString isbnUrl = "http://api.douban.com/book/subject/isbn/"; rn rnpublic static void main(String[] args) throws Exception rn //requestUrl = isbnUrl + isbnNo + "?apikey=" + apikey; rn //eg:http://api.douban.com/book/subject/isbn/9787111298854?apikey=111111111111111111114 rn ISBN isbnTest = new ISBN(); rn String isbnNo = "9787111298854"; rn String xml = isbnTest.fetchBookInfoByXML(isbnNo); rn System.out.println(xml); rn rn rn/** rn * 从根据isbn号从豆瓣获取数据。已经申请apikey,每分钟最多40次请求,足够用。 rn * @param isbnNo rn * @return rn * @throws IOException rn */ rnpublic String fetchBookInfoByXML(String isbnNo) throws IOException rn String requestUrl = isbnUrl + isbnNo + "?apikey=" + apikey; rn URL url = new URL(requestUrl); rn URLConnection conn = url.openConnection(); rn InputStream is = conn.getInputStream(); rn InputStreamReader isr = new InputStreamReader(is, "utf-8"); rn BufferedReader br = new BufferedReader(isr); rn StringBuilder sb = new StringBuilder(); rn rn String line = null; rn while ((line = br.readLine()) != null) rn sb.append(line); rn rn rn br.close(); rn return sb.toString(); rn rnrn[/code]
求把JAVA代码转成.NET代码
import java.security.Key;rnimport java.security.Security;rnimport java.util.Iterator;rnimport java.util.List;rnimport javax.crypto.Cipher;rnimport org.jdom.input.SAXBuilder;rnrnpublic class SsoClass rn private static String strDefaultKey = "exp.gov.cn";rn private Cipher encryptCipher = null;rn private Cipher decryptCipher = null;rn /**rn * 将byte数组转换为表示16进制值的字符串, 如:byte[]8,18转换为:0813, 和public static byte[]rn * hexStr2ByteArr(String strIn) 互为可逆的转换过程rn * 需要转换的byte数组rn * @return 转换后的字符串rn * @throws Exceptionrn * 本方法不处理任何异常,所有异常全部抛出rn */rn public static String byteArr2HexStr(byte[] arrB) throws Exception rn int iLen = arrB.length;rn // 每个byte用两个字符才能表示,所以字符串的长度是数组长度的两倍rn StringBuffer sb = new StringBuffer(iLen * 2);rn for (int i = 0; i < iLen; i++) rn int intTmp = arrB[i];rn // 把负数转换为正数rn while (intTmp < 0) rn intTmp = intTmp + 256;rn rn // 小于0F的数需要在前面补0rn if (intTmp < 16) rn sb.append("0");rn rn sb.append(Integer.toString(intTmp, 16));rn rn return sb.toString();rn rn /**rn * 将表示16进制值的字符串转换为byte数组, 和public static String byteArr2HexStr(byte[] arrB)rn * 互为可逆的转换过程rn * 需要转换的字符串rn * @return 转换后的byte数组rn * @throws Exceptionrn * 本方法不处理任何异常,所有异常全部抛出rn */rn public static byte[] hexStr2ByteArr(String strIn) throws Exception rn byte[] arrB = strIn.getBytes();rn int iLen = arrB.length;rnrn // 两个字符表示一个字节,所以字节数组长度是字符串长度除以2rn byte[] arrOut = new byte[iLen / 2];rn for (int i = 0; i < iLen; i = i + 2) rn String strTmp = new String(arrB, i, 2);rn arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16);rn rn return arrOut;rn rn /**rn * 默认构造方法,使用默认密钥rn */rn public SsoClass() throws Exception rn this(strDefaultKey);rn rn public SsoClass(String strKey) throws Exception rn Security.addProvider(new com.sun.crypto.provider.SunJCE());rn Key key = getKey(strKey.getBytes());rn// synchronized (Cipher.class)rn// rn encryptCipher = Cipher.getInstance("DES");rn encryptCipher.init(Cipher.ENCRYPT_MODE, key);rn decryptCipher = Cipher.getInstance("DES");rn decryptCipher.init(Cipher.DECRYPT_MODE, key);rn// rn rn public byte[] encrypt(byte[] arrB) throws Exception rn return encryptCipher.doFinal(arrB);rn rnrn public String encrypt(String strIn) throws Exception rn return byteArr2HexStr(encrypt(strIn.getBytes()));rn rnrn public byte[] decrypt(byte[] arrB) throws Exception rn return decryptCipher.doFinal(arrB);rn rn /**rn * 解密字符串rn * @param strInrn * @return 解密后的字符串rn * @throws Exceptionrn */rn public String decrypt(String strIn) throws Exception rn return new String(decrypt(hexStr2ByteArr(strIn)));rn rn private Key getKey(byte[] arrBTmp) throws Exception rn // 创建一个空的8位字节数组(默认值为0)rn byte[] arrB = new byte[8];rnrn // 将原始字节数组转换为8位rn for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) rn arrB[i] = arrBTmp[i];rn rn // 生成密钥rn Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");rn return key;rn rnrn public boolean verifyAuth( String auth, String info, String location, String logtime ) rn String allInfo = info + location + logtime;rn MD5 md5 = new MD5();rn allInfo = md5.getMd5( allInfo );rn //System.out.println( allInfo );rn if ( auth.equals(allInfo)==true)rn return true;rn elsern return false;rn rn rn public boolean verifyTime( String fromTime, int maxTime ) rn //有效期必须大于1分钟,否则使用系统默认20分钟的有效期rn rn maxTime = ( maxTime>60000 ) ? maxTime : 1200000;rn long nowTime = System.currentTimeMillis();rn nowTime = nowTime - Long.parseLong(fromTime);rn if ( nowTime <= maxTime )rn return true;rn elsern return false;rn rn rn /**rn * 将用户加密信息进行解密并返回到一个数组rn * rn * @param inforn * 加密的用户信息rn * @return 解密后的用户信息数组rn */rn public String[] getInfoDetail(String info) throws Exception rnrn info = new SsoClass().decrypt( info );rn String[] result = info.split("\\|"); rn return result;rn rn rnrn /**rn * 获取数组形式的用户可访问的业务系统的权限代码rn * rn * @param privInforn * 用户可访问的业务系统的权限代码组合rn * @return 数组形式的权限代码rn */rn public String[] getSysPriv(String privInfo) throws Exception rn //System.out.println(privInfo);rn String[] result = privInfo.split(","); rn return result;rn rn rn rn /**rn * 获取单点登录系统所有用户信息rn * rn * @param xmlUrlrn * 远程xml文件地址rn * @return 用户信息的二维数组rn */ rn public String[][] getSsoUser( String xmlUrl ) throws Exception rn SAXBuilder sb = new SAXBuilder();rn //xmlUrl为空,则使用默认地址rn xmlUrl = ( xmlUrl == "") ? "http://localhost:8080/test/a.xml" : xmlUrl;rn URL xmlurl = new URL( xmlUrl ); rn Document doc = sb.build( xmlurl );rn Element root = doc.getRootElement();rn List products = root.getChildren("VALUE");rn Element product = null;rn String colName = "";rn String colValue = "";rn int m = 0;rn //System.out.println( products.size());rn String allList[][] = new String[products.size()][];rn for ( int i=0; i
高分,帮忙下,谁知道把PhP代码转成Java代码。。。
我不懂PhP,,,谁能麻烦下,把以下PhP代码转成Java代码。。rnrn谢谢。。。rnrn[url=http://www.itlearner.com/article/4602]原代码地址[/url]rnrnrn[php] rnrn* @version $Id: InstantRecorder.php, v 1.0 2008/4/21 $rn* @package systenrn* @link http://www.guigui8.com/index.php/archives/108.htmlrn*rn* history: rn* 1. add this file. (by 桂桂 on 2008/4/21)rn*/rndefine('INSTANT_DATA_SEP', '|g|'); //及时存储的数据 字段间的分隔符rndefine('MAX_MEM_QUEUE_LENGTH', 1000); //memcached中允许存在记录条数的最大值rn/**rn*=--------------------------------------------------------------------=rn* class InstantRecorderrn*=--------------------------------------------------------------------=rn* rn* 及时数据记录类 的 工场类rn* rn*/rnclass InstantRecorderrnrn/**rn * 获取及时数据记录的对象实例rn *rn * @param string $modern * @param string $dir - 最终存储文件时,数据文件被存储的目录路径rn * @param string $dataFileSurfix - 最终存储文件时,数据文件名的后缀rn * @return InstantMemcachedRecorder or InstantFileRecorder objectrn */rnstatic public function getRecorder($mode, $dir = '', $dataFileSurfix = '') rn switch (trim($mode)) rn case 'mem':rn return new InstantMemcachedRecorder($dir, $dataFileSurfix);rn break;rn case 'file':rn return new InstantFileRecorder($dir, $dataFileSurfix);rn break;rn default:rn return new InstantFileRecorder($dir, $dataFileSurfix);rn // end of switchrn//end of functionrnrn//end of classrn/**rn*=--------------------------------------------------------------------=rn* class InstantMemcachedRecorderrn*=--------------------------------------------------------------------=rn* rn* 用memcache记录及时数据的处理类rn* rn* 注:memcache记录的数据,最终要被写到文件中去;rn* 写入时机根据memcache设置的缓存队列长度而定。rn* 请通过setQueueLength()方法设置队列长度。rn* rn*/rnclass InstantMemcachedRecorderrnrnprivate $_host = "127.0.0.1"; //提供memcache服务的主机rnprivate $_port = "11211"; //memcache使用端口号rnprivate $_dataFileSurfix; //数据文件名的后缀rnprivate $_baseDir; //数据文件的目录路径 rnrnprivate $_memcachedObj; //memcached对象句柄rnprivate $_queueLenth; //memcached允许的某个索引对应的记录队列条数的最大值rnrnrn/**rn *=-------------------------------------------------------------------=rn *=-------------------------------------------------------------------=rn* Public Methodsrn *=-------------------------------------------------------------------=rn *=-------------------------------------------------------------------=rn */rnrn/**rn * memcache及时数据记录的对象构造函数rn *rn * @param string $dir - 最终存储文件时,数据文件被存储的目录路径rn * @param string $dataFileSurfix - 最终存储文件时,数据文件名的后缀rn * @return InstantMemcachedRecorder objectrn */rnpublic function __construct($dir = '', $dataFileSurfix = '') rn if (empty($dir)) rn $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;rn rn if (empty($dataFileSurfix)) rn $dataFileSurfix = '_noname.txt';rn rn $this->setBaseDir($dir);rn $this->setDataFileSurfix($dataFileSurfix);rn $this->_queueLenth = MAX_MEM_QUEUE_LENGTH;rnrnrn/**rn * 设置memcache缓存队列的长度rn *rn * @param unknown_type $lenrn * @return unknownrn */rnpublic function setQueueLength($len=0) rn $len = intval($len);rn if ($len < 1) return false;rn $this->_queueLenth = $len;rnrnrnrn/**rn * 设置数据文件的文件缀名rn *rn * @param unknown_type $strrn */rnpublic function setDataFileSurfix($str) rn $this->_dataFileSurfix = $str;rnrnrn/**rn * 设置数据文件名rn *rn * @param unknown_type $strrn */rnpublic function setDateFileName($str) rn $this->_dateFileName = $str;rnrnrn/**rn * 设置数据文件的目录路径rn *rn * @param unknown_type $dirrn */rnpublic function setBaseDir($dir) rn $this->_baseDir = $dir;rnrnrn/**rn * 将数据进行及时记录rn *rn * @param string $datarn * @return booleanrn */rnpublic function record($data) rn //rn // 1. detect and initiate memcache module, if not found, the then use file writing strategy.rn //rn if (!class_exists('Memcache') || !function_exists('memcache_connect')) rn $file_recorder = new InstantFileRecorder($this->_baseDir, $this->_dataFileSurfix);rn return $file_recorder->record($data);rn else rn $this->_initMemcached();rn rn rn rn //rn //2. write data into memcache.rn //rn $data_key_prefix = trim($this->_baseDir) . trim($this->_dataFileSurfix);rn $num_key = $data_key_prefix . '_num';rn $cur_queue_num = intval($this->_memcachedObj->get($num_key));rn $data_key = $data_key_prefix . $cur_queue_num;rn rn $this->_memcachedObj->set($data_key, $data . "\r\n");rn rn if ($cur_queue_num >= $this->_queueLenth - 1) rn //if the record time surplus 23:55, we write all memcached data into file. rn $this->_writeIntoFile($data_key_prefix, $this->_queueLenth);rn $this->_memcachedObj->set($num_key, 0);rn else rn $this->_memcachedObj->set($num_key, $cur_queue_num + 1);rn rn //if the record time surplus 23:55, we write all memcached data into file. rn if (intval(date('Hi')) >= 2355) rn $this->_writeIntoFile($data_key_prefix, $cur_queue_num + 1);rn $this->_memcachedObj->set($num_key, 0);rn rn rn return true;rnrnrn/**rn * 将所有通过本类处理的所有memcache数据,立即写入到文件rn *rn * @return unknownrn */rnpublic function clearMemData() rn $this->_initMemcached();rn $data_key_prefix = trim($this->_baseDir) . trim($this->_dataFileSurfix);rn return $this->_writeIntoFile($data_key_prefix);rnrnrnrn/**rn *=-------------------------------------------------------------------=rn *=-------------------------------------------------------------------=rn* Private Methodsrn *=-------------------------------------------------------------------=rn *=-------------------------------------------------------------------=rn */rnrn/**rn * 初始化memcache对象句柄rn *rn */rnprivate function _initMemcached() rn $this->_memcachedObj = new Memcache();rn $this->_memcachedObj->connect($this->_host, $this->_port) rn or die ("Could not connect memcached server!");rnrnrn/**rn * 将memcache缓存的数据 立即 写入到指定的 文件rn *rn * @param string $data_key_prefix - 被写入的memcache数据key的前缀名rn * @param integer $flush_queue_len - 设置写入的队列长度(默认为0,表示都写入)rn */rnprivate function _writeIntoFile($data_key_prefix, $flush_queue_len=0) rn $flush_queue_len == 0 && $flush_queue_len = $this->_queueLenth;rn $file_recorder = new InstantFileRecorder($this->_baseDir, $this->_dataFileSurfix);rn $data = '';rn for ($i = 0; $i < $flush_queue_len; $i++) rn $data_key = $data_key_prefix . $i;rn $data .= $this->_memcachedObj->get($data_key);rn $this->_memcachedObj->set($data_key, '');rn rn $data = substr($data, 0, -2);rn $file_recorder->record($data);rnrnrnprivate function _needFlush() rnrn//end of class
JAVA代码转成C#
/** 把图像以1或0方式打印 */ rn public static void printImageToDots(String filePath) throws Exception rn File file = new File(filePath); rn BufferedImage read = ImageIO.read(file); rn WritableRaster raster = read.getRaster(); rn int pixelSize = read.getColorModel().getPixelSize(); rn System.out.println("==像素==" + pixelSize); rn if (pixelSize > 2) rn return; rn rn int width = read.getWidth(); rn int height = read.getHeight(); rn int[] pixels = new int[width]; rn StringBuffer sb = new StringBuffer(); rn for (int i = 0; i < height; i++) rn Arrays.fill(pixels, 0xFF); rn raster.getPixels(0, i, width, 1, pixels); rn int[] p1 = getBytes(pixels); rn for (int j = 0; j < p1.length; j++) rn java.text.DecimalFormat df = new java.text.DecimalFormat( rn "00000000"); rn sb.append(df.format(Integer.valueOf(Integer rn .toBinaryString(p1[j])))); rn rn sb.append("\n"); rn rn System.out.println(sb.toString()); rn
将java代码转成C#
/** 把图像以1或0方式打印 */rn public static void printImageToDots(String filePath) throws Exception rn File file = new File(filePath);rn BufferedImage read = ImageIO.read(file);rn WritableRaster raster = read.getRaster();rn int pixelSize = read.getColorModel().getPixelSize();rn System.out.println("==像素==" + pixelSize);rn if (pixelSize > 2) rn return;rn rn int width = read.getWidth();rn int height = read.getHeight();rn int[] pixels = new int[width];rn StringBuffer sb = new StringBuffer();rn for (int i = 0; i < height; i++) rn Arrays.fill(pixels, 0xFF);rn raster.getPixels(0, i, width, 1, pixels);rn int[] p1 = getBytes(pixels);rn for (int j = 0; j < p1.length; j++) rn java.text.DecimalFormat df = new java.text.DecimalFormat(rn "00000000");rn sb.append(df.format(Integer.valueOf(Integerrn .toBinaryString(p1[j]))));rn rn sb.append("\n");rn rn System.out.println(sb.toString());rn rnrnrn////////////////////////////////////////rnrn private static Object imagePixelToPos(BufferedImage bmp, int m, int dots, rn int widthRange, Object toReturn) throws Exception rn //------------- 图像的基本属性 ---------------- rn int width = bmp.getWidth(); rn int height = bmp.getHeight(); rn int nl = width % 256; rn int nh = width / 256; rn int ch = (height + dots - 1) / dots; rn if (width > widthRange) rn throw new Exception("==图像宽度超打印范围=="); rn rn //====================END====================== rn rn //------------- 输出String或Byte形式的POS命令 ---------------- rn StringBuffer sb = null; rn ByteArrayOutputStream baos = null; rn String cmdStr1 = null; rn String cmdStr2 = ", (byte)0x0A, \n"; rn int[] cmdByte1 = new int[] 0x1B, 0x2A, m, nl, nh ; rn int[] cmdByte2 = new int[] 0x0A ; rn if (toReturn instanceof String) rn sb = new StringBuffer(); rn cmdStr1 = "(byte)0x1B, (byte)0x2A, (byte)0x%s, (byte)0x%s, (byte)0x%s"; rn cmdStr1 = String.format(cmdStr1, new Object[] rn Integer.toHexString(m), Integer.toHexString(nl), rn Integer.toHexString(nh) ); rn else if (toReturn instanceof byte[]) rn baos = new ByteArrayOutputStream(); rn else rn baos = new ByteArrayOutputStream(); rn rn //=======================END================================== rn //获得像素Raster rn Raster raster = getRaster(bmp); rn rn //按列取点 rn int[] p3 = new int[dots]; rn for (int h = 0; h < ch; h++) rn //------- 输出POS命令 ESC * m nl nh -------- rn if (sb != null) rn posCmd(sb, cmdStr1); rn else if (baos != null) rn posCmd(baos, cmdByte1); rn rn //===================END====================== rn for (int w = 0; w < width; w++) rn //值填充,白点 rn Arrays.fill(p3, 0xFF); rn raster rn .getPixels(w, h * dots, 1, rn (h + 1 == ch ? height - dots * h : dots), rn p3); rn rn //把每8个点输出成一个字节 rn int[] bytes = getBytes(p3); rn //把每个字节以POS命令形式输出 rn if (sb != null) rn resultStratergy(sb, bytes); rn else if (baos != null) rn resultStratergy(baos, bytes); rn rn rn //------- 输出POS命令 0x0A -------- rn if (sb != null) rn posCmd(sb, cmdStr2); rn else if (baos != null) rn posCmd(baos, cmdByte2); rn rn //===============END================= rn rn //------- 字符串修正 -------- rn if (sb != null && sb.length() > 3) rn sb.setLength(sb.length() - 3); rn String toString = sb.toString(); rn System.out.println(toString); rn rn //=============END============ rn return sb == null ? baos.toByteArray() : sb.toString(); rn rnrn
.net转成JAVA代码
if (Request.QueryString["layername"] == null && Request.QueryString["keyvalue"] == null) return; rnrn string Url = "http://10.22.112.21:8719/NewMapServer/WebServices/FeatureServer.php?layer=" + Request.QueryString["layername"] .ToString() rn + "&request=query&WHERE"; rn string whereClause = "= 名称 LIKE '%" + Request.QueryString["keyvalue"] .ToString()+ "%'"; rn whereClause = Server.HtmlEncode(whereClause); rnrn HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url+whereClause); rn request.Timeout = 30000; rn request.Headers.Set("Pragma", "no-cache"); rn HttpWebResponse response = (HttpWebResponse)request.GetResponse(); rn Stream streamReceive = response.GetResponseStream(); rn Encoding encoding = Encoding.GetEncoding("UTF-8"); rn StreamReader streamReader = new StreamReader(streamReceive, encoding); rn string strResult = streamReader.ReadToEnd(); rn streamReader.Close(); rn _jsonStr=strResult; rnrn上面是一段.NET代码,请问各位能不能帮我翻译成JAVA代码啊 rnrnHttpWebRequest 到底对应JAVA中的哪个对象啊
汉字转成拼音 Java代码
汉字转成拼音 Java代码,很完整的啊
将C# 转成Java代码
如题。求大神帮帮忙。谢谢。。。rn 1 using System;rn 2 using System.Data;rn 3 using System.Configuration;rn 4 using System.Web;rn 5 using System.Web.Security;rn 6 using System.Web.UI;rn 7 using System.Web.UI.WebControls;rn 8 using System.Web.UI.WebControls.WebParts;rn 9 using System.Web.UI.HtmlControls;rn10 using System.Diagnostics;rn11 using System.IO;rn12 rn13 /// rn14 /// Pdf2Swf 将pdf转化为swfrn15 /// rn16 public class Pdf2Swfrn17 rn18 public Pdf2Swf()rn19 rn20 //rn21 // TODO: 在此处添加构造函数逻辑rn22 //rn23 rn24 public void PDFConvertToSWF(string sourcePath, string targetPath)rn25 rn26 Process p = new Process();rn27 p.StartInfo.FileName = "cmd.exe ";rn28 p.StartInfo.UseShellExecute = false;rn29 p.StartInfo.RedirectStandardInput = true;rn30 p.StartInfo.RedirectStandardOutput = true;rn31 p.StartInfo.RedirectStandardError = true;rn32 p.StartInfo.CreateNoWindow = true;rn33 p.Start();rn34 string cmd = "pdf2swf.exe" + " " + sourcePath + " -o " + targetPath;rn35 p.StandardInput.WriteLine(cmd);rn36 p.Close();rn37 rn38 rnrnrn需要知道转换过的java 代码应该怎么写
CRC的JAVA代码转成C++?
请问如何将下面的JAVA代码转成C++的,谢谢了先~rn[code=Java]Generate the CRC Lookup Tablernvoid generateCRCTable() rnint i, j, data, accumulator;rnfor (j=0; j<256; j++) rndata = j;rnaccumulator = 0;rndata <<= 8;rnfor (i=8; i>0; i--) rnif (((data ^ accumulator) & 0x8000) > 0)rnaccumulator = (accumulator << 1) ^ 0x1021;rnelsernaccumulator <<= 1;rndata <<= 1;rnrnthis.crcTable[j] = accumulator;rnrnrnRetrieve a CRC ValuernString getCRC(byte[] arg) rnint i, accumulator, data, index;rnString returnValue = new String();rnaccumulator = 0xffff;rnfor (i=0; i> 8) ^ data;rnaccumulator = (accumulator << 8) ^ this.crcTable[index];rnrnaccumulator ^= 0xffff;rnreturnValue = Integer.toHexString(accumulator).toUpperCase();rnfor (i=returnValue.length(); i<4; i++)rnreturnValue = '0' + returnValue;rnreturn returnValue;rnrnGenerating a Full Command Stringrnpublic String generateCommandString(char commandCharacter,rnString dataSection) rnString stringToSend;rnchar[] commandString = 0x01, '0', commandCharacter, 0x02;rnstringToSend = new String(commandString) +rndataSection + (char) 0x03;rnstringToSend += getCRC(stringToSend.getBytes());rnWWW.JAMEXVENDING.COMrn14rnreturn stringToSend;rn[/code]
如何把caj转成pdf
如何把caj转成pdf
onvif wsdl转成java代码
onvif协议的开发,wsdl转成为java包,导入eclipse即可使用,可二次开发
c++转成java代码
int abc(unsigned char *data, int length)rnrn unsigned char * p = data;rn unsigned char * pz = data+length;rnrn while (p
PHP代码转成java代码
-
ICEpdf把pdf转成图片
背景:要求手机能在线预览pdf文件的内容。 pc的话可以很方便的利用开源的一些js来加载pdf,但是在手机上却行不通,只能变通一下,把pdf转成图片,然后手机按页去请求pdf的内容。 icepdf官网:http://www.icesoft.org/java/downloads/icepdf-downloads.jsf 最新版是6.2.3 public class PdfUtil { s
如何把图片转成PDF?
请教各位大侠,如何[color=#FF0000]用代码[/color]将图片(各种格式,bmp,jpg,等等)转化成PDF格式?rn本人已安装了Acrobat_8_Pro_SC,在VS.NET中组件Acrobat Distiller的File2PDF函数时,入口文件必须是PS(PostScript)格式。请问如何把图片转成PS格式,是不是要安装PS打印驱动,如果安装了驱动如何在程序中调用该驱动生成PS文件?rn Acrobat_8_Pro_SC还包含了另一个组件PDFMAKER,该组件可以将MS OFFICE生成的格式文档直接转换成PDF,可是没有找到把图片转化成PDF的方法,但我觉得这组件应该可以转图片成PDF的。rn这个问题已经困惑我1整天了,在此请各位大侠指点迷津,谢谢了。rn如果哪位能提供下Acrobat的开发文档,不盛感激。
pythong把html转成pdf
主要介绍一些python强大有趣的库和工具
怎样把jpg转成pdf
迅捷jpg转pdf转换器是一款界面简洁,操作方便的jpg转pdf转换工具。jpg转pdf转换器可方便的将各种流行的图片文件格式如 jpg,bmp,tif,png,gif等转换成pdf文件。
如何把ppt转成pdf
迅捷PPT转换成PDF转换器具备万能转换模式,针对不同类型、不同内容以及不同排版的PPT文件内容,都可以轻松实现一键完美转换,是办公学习中必选的软件!
怎么把pdf转成word
在日常使用中,经常遇到下载了pdf,却不能对其上的文字进行修改,此文档将教你如何把pdf转成word文档形式。
如何把PDF转成图片
现在PDF文档的规范性使得浏览者在阅读上方便了许多,但如果想要从里面提取些资料,实在是麻烦,回忆一起做毕业设计的时候为了PDF文档中的资料竟然选择截图下来,想想也是傻,今天小编来教大家一种可以将PDF转换成图片获取PDF文件内容的方法。 第一步:打开电脑进入浏览器搜索“迅捷PDF在线转换器”进入在线页面。 第二步:进入到在线页面后,找到页面内的“文档转换”并在下拉框内选择“PDF转图片”,进入...
Python把URL编码转成正常编码
编码转化代码 #-*-coding:utf8-*- import urllib import codecs import sys reload(sys) sys.setdefaultencoding('utf-8') data_file = codecs.open(u&quot;清洗后大搜数据bad_1_clean.txt&quot;, &quot;w&quot;, encoding=&quot;utf8&quot;) file = codecs....
如何把物理地址转成虚拟地址(URL)~~~~
如何把物理地址转成虚拟地址(URL)~~~~rn如把d:wwwroot\upload\1.txt转换成http://xxxx/upload/1.txt???
怎么把相对路径转成url地址
怎么把相对路径转成url地址
java代码中URL加密
java中对一串URL进行加密,并建立指定密钥的算法及规则,并建立解密方式进行比对截取解密后的数据。
Java代码调用Url接口
url = new URL(urlString); URLConnection connection = url.openConnection(); connection.setConnectTimeout(1000); connection.connect(); connection.getInputStream(); 注意,需要对url中的参数进行url编码,否则报服务器50
url快捷方式下载的java代码
网页应用下载到本地. 类似于直接在桌面建立一个文件,后缀名是.url 再该文件中写上网页的网址,图标等,可用作快捷方式,点击直接登录网站!
java代码请求URL
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class TestWx1 {
url签名验证java代码
import org.apache.commons.codec.digest.DigestUtils; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Comparator...
用python将Gb2312转成URL编码
#!-*- encoding:utf-8 -*- import urllib.parse name = u'中国' encodedUrl = name.encode('gb2312') decodedUrl = urllib.parse.quote(encodedUrl) print(decodedUrl) parse.unquote(str2) 
Oracle 的months_between(函数)转成java代码
这是从网上复制的 不知道对不对 n最好能解释下months_between(函数)的源码是怎么操作的 npublic class Months_between nn /**n * 计算两个日期相差的月份数n *n * @param date1 日期1n * @param date2 日期2n * @param pattern 日期1和日期2的日期格式n * @return 相差的月份数n * @throwsn */n private Date date1;n private Date date2;nn public static int countMonths(String date1, String date2, String pattern) throws ParseException n SimpleDateFormat sdf = new SimpleDateFormat(pattern);nn Calendar c1 = Calendar.getInstance();n Calendar c2 = Calendar.getInstance();nn c1.setTime(sdf.parse(date1));n c2.setTime(sdf.parse(date2));nn int year = c2.get(Calendar.YEAR) - c1.get(Calendar.YEAR);nn /*//开始日期若小月结束日期n if (year < 0) n year = -year;n return year * 12 + c1.get(Calendar.MONTH) - c2.get(Calendar.MONTH);n */nn return year * 12 + c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH);n nnn
求c++代码转成java代码⋯⋯⋯⋯
#includen#includen#includenusing namespace std;nstruct studentnn char name[11];n int solve;n int cost;nstu[10000];nbool cmp(student a,student b)nn if(a.solve!=b.solve)n if(a.solve>b.solve)n return true;n elsen return false;n else if(a.cost==b.cost)n n return(strcmp(a.name,b.name)<0);n n n elsen n return(a.cost>n>>m)n n int t=0;n while(cin>>stu[t].name)n n if(strcmp(stu[t].name,"eof")==0)n break;n for(i=0;i>s;n if(s>0)n n stu[t].solve++;n k=0;n if(getchar()=='(')n n cin>>k;n cin>>ch;n n stu[t].cost=stu[t].cost+s+k*m;n n n t++;n n sort(stu,stu+t,cmp);n for(i=0;i
江湖救急 pb代码转成java代码
string ls_bankrnrnstring ls_Bank_Idrnstring ls_header120,ls_Body100,ls_check60,ls_tail232rnInteger li_herder[1 to 40]rnInteger li_Body10_10[1 to 10,1 to 10]rnInteger li_check6_10[1 to 6,1 to 10],li_check_6_10[1 to 6,1 to 10]rnInteger i,j,k,temp_i,temp_jrnrnInt li_Body34[1 to 34]rnrnstring ls_prnls_header120=mid(as_password,1,120)rnls_Body100 =mid(as_password,121,100)rnls_check60 =mid(as_password,221,60)rnls_tail232 =mid(as_password,281,232)rnrnfor i=1 to 40rn li_herder[i]=Integer(mid(ls_header120,i*3 - 2,3))rn if i<=34 then rn li_Body34[i]=Integer(mid(ls_Body100,i*3 - 2,3))rn li_Body34[i]=li_Body34[i] - li_herder[i]rn end ifrnnextrnli_Body34[34]=48rnrnfor i=1 to 10rn for j=1 to 10rn li_Body10_10[i,j] = Integer(mid(ls_Body100,(i -1)*10+j,1)) rn next rnnextrnrnfor i=1 to 6 //加密矩阵的方式: - | \ / N Zrn for j=1 to 10rn li_check6_10[i,j] = mod(Integer(mid(ls_check60,(i -1)*10+j,1)) ,10)rn next rnnextrnrn//-----------------------------------------------------------------------------------rnfor i=1 to 10rn for k=1 to 6rn li_check_6_10[K,i]=0rn NextrnNextrnrnfor i=1 to 10rn for j=1 to 10rn ls_p=ls_p+String(li_Body10_10[j,i])/////////rn for k=1 to 6 rn Choose Case krn case 1 // - rn li_check_6_10[K,i] =li_check_6_10[K,i]+li_Body10_10[i,j]rn li_check_6_10[K,i] = mod(li_check_6_10[K,i],10)rn case 2 // | rn li_check_6_10[K,i] =li_check_6_10[K,i]+li_Body10_10[j,i]rn li_check_6_10[K,i] = mod(li_check_6_10[K,i],10)rn Case 3 // \ rn li_check_6_10[K,i] =li_check_6_10[K,i]+li_Body10_10[j,mod(i+j -1,10)+1]rn li_check_6_10[K,i] = mod(li_check_6_10[K,i],10)rn Case 4 // / rn li_check_6_10[K,i] =li_check_6_10[K,i]+li_Body10_10[j,mod(10 - j +i,10)+1]rn li_check_6_10[K,i] = mod(li_check_6_10[K,i],10)rn Case 5 // N rn temp_j = mod(i + mod(j+1,2)- 1 ,10) +1rn li_check_6_10[K,i] =li_check_6_10[K,i]+li_Body10_10[j,temp_j]rn li_check_6_10[K,i] = mod(li_check_6_10[K,i],10)rn Case 6 // Z rn temp_j = mod(10 + i - mod(j+1,2)- 1 ,10) +1rn li_check_6_10[K,i] =li_check_6_10[K,i]+li_Body10_10[j,temp_j]rn li_check_6_10[K,i] = mod(li_check_6_10[K,i],10) rn End Choose rn next rn ls_p=left(ls_p+String(li_Body10_10[j,i]),12)/////////rn nextrnNextrnrnrnfor i=1 to 6rn for j=1 to 10rn if li_check6_10[i,j]<>li_check_6_10[i,j] thenrn ls_p='abc1234567'rn End ifrn nextrnnextrnrn//-----------------------------------------------------------------------------------rngs_Bank_Id = ProfileString( gs_Ini_File, "Common", "bank", "")rnls_Bank_Id=left(gs_Bank_Id,20)rnrnli_herder[40]=li_herder[40]/10rn//messageBox('',char(li_Body34[1]) + char(li_Body34[2]) )rn//messageBox('',char(li_Body34[3]) + char(li_Body34[4]) )rn//messageBox('',char(li_Body34[5]) + char(li_Body34[6]) )rnls_bank = ''rnrnfor i=1 to len(gs_Bank_Id)rn ls_bank=ls_bank+Char(li_Body34[i])rnNextrnrnif ls_bank = gs_Bank_Id then rn for i=len(ls_bank)+1 to li_herder[40]rn ls_p=ls_p+ Char(li_Body34[i])rn NextrnEnd ifrnrnls_p=mid(ls_p,13)//截取指定字符串 arg0 要截取的字符串 arg1 截取长度rnreturn ls_p
!!!将java代码转成C#代码!!!
rnpublic void invoke(MessageContext context) throws Exception rn final Namespace ns = Namespace.getNamespace("xa", "http://service.xfire.module.webservice.xa.com");rn Element el = new Element("header", ns);rnrn Element auth = new Element("AuthenticationToken", ns);rn Element username_el = new Element("Username", ns);rn username_el.addContent(username);rn Element password_el = new Element("Password", ns);rn password_el.addContent(password);rn auth.addContent(username_el);rn auth.addContent(password_el);rn el.addContent(auth);rn context.getCurrentMessage().setHeader(el);rn rnrn请大虾们帮帮忙,将上面代码转成C#代码,谢谢!!
java代码 把mht格式转化pdf格式
java代码 把mht格式转化pdf格式
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制