BufferedInputStream属于字节流,那字节流和字符流的区别是什么

网上说字节流和字符流的区别是:
字节流在操作时本身不会用到缓冲区(内存),是文件本身直接操作的,而字符流在操作时使用了缓冲区,通过缓冲区再操作文件。
而BufferedInputStream和BufferedOutputStream创建一个内部缓冲区数组并将其存储在 buf 中,该buf的大小默认为8192,也使用到了缓冲区,为什么属于字节流,不属于字符流。

3个回答

因为他是以字节的方式处理文件的,而不是字符

这个你要明白字节和字符的区别。直接永远都是1个8位2进制的组。但是字符不一定,比如说中文就是双字节的。因为缓冲区大小按照字节来计算,所以是字节流

简单的举个例子:字符流只能传输字符,但是字节流可以传输字符.音频,图片等等

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
InputStream的read()方法却和基类相同,怎么理解他的缓冲作用?
字符流缓冲器BufferedReader可以实现正行读取,达到缓冲作用,字节流缓冲器BufferedInputStream的read()方法却和基类相同,怎么理解他的缓冲作用?
麻烦大神帮忙看下 java.net.SocketException: Connection reset 不是经常出现间歇性出现
错误代码 java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:210) at java.net.SocketInputStream.read(SocketInputStream.java:141) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read(BufferedInputStream.java:265) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106) at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116) at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at com.example.madame.service.JokeService.jokeGet(JokeService.java:86) at com.example.madame.controller.OneSentencePerDayController.test35(OneSentencePerDayController.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) 我的代码 public String joke() { try { // String urlTypeName = java.net.URLEncoder.encode(city1, "utf-8"); URL url = new URL("xxx"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(5000); conn.setRequestMethod("GET"); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { //结果码=200 InputStream is = conn.getInputStream(); //内存流 , ByteArrayOutputStream boas = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = -1; while (is.available() != 0&&(len = is.read(buffer)) != -1) { boas.write(buffer, 0, len); } System.out.println("GET请求获取的数据:" + boas.toString()); JSONObject jsonObject = JSONObject.fromObject(boas.toString()); String reason = String.valueOf(jsonObject.get("reason")); if ("success".equals(reason)) { Object result = jsonObject.get("result"); JSONArray jsonArray = JSONArray.fromObject(result.toString()); int count = 0; String joke = ""; if (jsonArray.size() > 0) { for (int i = 0; i < jsonArray.size(); i++) { String content = String.valueOf(JSONObject.fromObject(jsonArray.get(i)).get("content")); count += 1; joke += " <tr align=\"center\" style=\"text-indent:2em;\">\n" + " <td >" + count + "." + content + "</td>\n" + " </tr>"; if (count == 3) { break; } } boas.close(); is.close(); return joke; } } } } catch (IOException e) { e.printStackTrace(); } return null; }
从服务器使用IO流下载文件,部分类型文件下载后内容出错
公司的门户网站需要实现文件上传下载功能。 在实现下载功能后,测试txt文件,下载成功。但是doc和图片等文件下载后,出现内容缺失问题。 以下为下载功能代码: ``` public class LayUiDownload extends HttpServlet { /** * Constructor of the object. */ public LayUiDownload() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } public synchronized void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String params=request.getParameter("params"); //Map<String, String[]>maps = request.getParameterMap(); String URL=params.substring(8,params.lastIndexOf("\"")); //URL=URL.replace("\\\\", "/"); String ori_url=URL; String URL0=URL.substring(0,URL.lastIndexOf("/")+1); String URL1=URL.substring(URL.lastIndexOf("/")+1); URL1 = URLEncoder.encode(URL1, "UTF-8"); URL=URL0+URL1; File file = null; try { // 统一资源 String urlPath =URL; // 统一资源 URL url = new URL(urlPath); // 连接类的父类,抽象类 URLConnection urlConnection = url.openConnection(); // http的连接类 HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection; //设置超时 httpURLConnection.setConnectTimeout(1000*5); //设置请求方式,默认是GET httpURLConnection.setRequestMethod("POST"); // 设置字符编码 httpURLConnection.setRequestProperty("Charset", "UTF-8"); httpURLConnection.connect(); int fileLength = httpURLConnection.getContentLength(); BufferedInputStream bin = new BufferedInputStream(httpURLConnection.getInputStream()); String fileFullName = ori_url.substring(ori_url.lastIndexOf("/")+1); // 指定存放位置 String path = "D:\\Program Files\\file" + File.separatorChar + fileFullName; file = new File(path); // 校验文件夹目录是否存在,不存在就创建一个目录 if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } OutputStream out = new FileOutputStream(file); int size = 0; int len = 0; byte[] buf = new byte[2048]; while ((size = bin.read(buf)) != -1) { len += size; out.write(buf, 0, size); System.out.println("下载了-------> " + len * 100 / fileLength + "%\n"); } System.out.println("C:"+ File.separatorChar + urlPath.substring(urlPath.lastIndexOf("/")).split("/")[1]); bin.close(); out.close(); System.out.println("文件下载成功!"); } catch (Exception e) { System.out.println("文件下载失败!"); e.printStackTrace(); }finally {![图片说明](https://img-ask.csdn.net/upload/202001/02/1577952059_62148.png) System.out.println("文件下载结束!"); } } } ``` 截图: 上传的正常文件: ![上传的正常文件](https://img-ask.csdn.net/upload/202001/02/1577951941_485868.png) 下载的问题文件: ![下载的问题文件](https://img-ask.csdn.net/upload/202001/02/1577951971_146949.png) 下载的问题图片文件: ![图片说明](https://img-ask.csdn.net/upload/202001/02/1577952125_525303.png) 问题已解决,原因是配置中对资源的访问只有TXT类型做了配置,其他类型文件的下载请求都被登录界面拦截了,多谢回答
java后台将base64字符串转换为PDF后生成的PDF打不开怎么回事呀
![图片说明](https://img-ask.csdn.net/upload/201910/12/1570868633_161609.jpg) 后台代码: public static void base64StringToPdf(String base64Content,String filePath){ File file = new File(filePath);// 将原来参数修改为字符串 BASE64Decoder decoder = new BASE64Decoder(); BufferedInputStream bin = null; FileOutputStream fout = null; BufferedOutputStream bout = null; try { //将base64编码的字符串解码成字节数组 byte[] bytes = decoder.decodeBuffer(base64Content); //创建一个将bytes作为其缓冲区的ByteArrayInputStream对象 ByteArrayInputStream bais = new ByteArrayInputStream(bytes); //创建从底层输入流中读取数据的缓冲输入流对象 bin = new BufferedInputStream(bais); //创建到指定文件的输出流 fout = new FileOutputStream(file); //为文件输出流对接缓冲输出流对象 bout = new BufferedOutputStream(fout); byte[] buffers = new byte[1024]; int len = bin.read(buffers); while(len != -1){ bout.write(buffers, 0, len); len = bin.read(buffers); } //刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题 bout.flush(); } catch (IOException e) { e.printStackTrace(); } finally { try { bout.close(); fout.close(); bin.close(); } catch (IOException e) { e.printStackTrace(); } } } 前台是将页面展示的数据图标什么的生成PDF 前台代码: function downloadofpdf(){ var varname = $("#taskid").text(); if(confirm("您确认下载该PDF文件吗?")){ var target = document.getElementById("bodyid"); target.style.background = "#FFFFFF"; // if(pdfName==''||pdfName==undefined) pdfName= getNowFormatDate(); html2canvas(target, { onrendered:function(canvas) { var contentWidth = canvas.width; var contentHeight = canvas.height; //一页pdf显示html页面生成的canvas高度; var pageHeight = contentWidth /1592.28 * 841.89; //未生成pdf的html页面高度 var leftHeight = contentHeight; //页面偏移 var position = 0; //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高 var imgWidth = 595.28; var imgHeight = 592.28/contentWidth * contentHeight; var pageData = canvas.toDataURL('image/jpeg', 1.0); var pdf = new jsPDF('', 'pt', 'a4'); //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89) //当内容未超过pdf一页显示的范围,无需分页 if (leftHeight < pageHeight) { pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight ); } else { while(leftHeight > 0) { pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight); leftHeight -= pageHeight; position -= 841.89; //避免添加空白页 if(leftHeight > 0) { pdf.addPage(); } } } pdf.save(varname+".pdf"); // 将pdf输入为base格式的字符串 var buffer = pdf.output("datauristring"); // // 将base64格式的字符串转换为file文件 // var myfile = dataURLtoFile(buffer, varname); // var formdata = new FormData(); // formdata.append(name, myfile); $.post("/riskManage/uploadpdf",{data:JSON.stringify({formdata:buffer})},function(result){ //alert("hao"); }) //sc(); }, background: "#fff" }) } }
JAVA用二进制文件类复制图片抛出EOFException
EOFException的意思我知道。我想知道怎么实现每次以4个字节的速度复制图片。用字符流会损坏图片,只能用字节流。字节流的子类DataInputStream和DataOutputStream配合每次就能传4个字节,传视屏不完整,但传图片就抛出EOFException。 import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class TestDateInputStream { public static void main(String[] args) { // TODO Auto-generated method stub try { DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(new File("E:\\Temp\\245368.jpg")))); DataOutputStream dos=new DataOutputStream(new BufferedOutputStream(new FileOutputStream(new File("E:\\Temp\\36544.jpg")))); int i=0; while( (i=dis.readInt())!=-1){ dos.writeInt(i); System.out.println(i); } dis.close(); dos.flush(); dos.close(); System.out.println("OK"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
请问下各位大佬们,我在用ksoap2-Android调用web service服务时出现了stream closed的报错
小弟仿照网上的一个例子想用web service服务写一个查询天气的安卓应用。 但是在该服务的第三个方法时出现了stream closed的错误,百度没有找到结果, 麻烦各位大神帮我看下,以下是我的代码,在根据城市获取城市具体天气情况这个 方法时报了错 提供服务的URL是http://ws.webxml.com.cn/WebServices/WeatherWS.asmx ``` public class WebServicerUtil { // 定义Web Service的命名空间 static final String SERVICE_NS = "http://WebXml.com.cn/"; // 定义Web Service提供服务的URL static final String SERVICE_URL = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx"; // 调用远程 Web Service获取省份列表 public static List<String> getProvinceList() { /** * 调用远程Web Service的getRegionProvince方法: 获得中国省份、直辖市、地区和与之对应的ID * <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>黑龙江,3113</string> <string>吉林,3114</string> <string>辽宁,3115</string> <string>内蒙古,3116</string> <string>河北,3117</string> <string>河南,3118</string> <string>山东,3119</string> <string>山西,31110</string> <string>江苏,31111</string> <string>安徽,31112</string> <string>陕西,31113</string> <string>宁夏,31114</string> <string>甘肃,31115</string> <string>青海,31116</string> <string>湖北,31117</string> <string>湖南,31118</string> <string>浙江,31119</string> <string>江西,31120</string> <string>福建,31121</string> <string>贵州,31122</string> <string>四川,31123</string> <string>广东,31124</string> <string>广西,31125</string> <string>云南,31126</string> <string>海南,31127</string> <string>新疆,31128</string> <string>西藏,31129</string> <string>台湾,31130</string> <string>北京,311101</string> <string>上海,311102</string> <string>天津,311103</string> <string>重庆,311104</string> <string>香港,311201</string> <string>澳门,311202</string> <string>钓鱼岛,311203</string> </ArrayOfString> */ String methodName = "getRegionProvince"; //获得中国省份、直辖市、地区和与之对应的ID // 创建HttpTransportSE传输对象,该对象用于调用Web Service操作 HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; // 使用SOAP1.1协议创建Envelop对象 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); // 实例化SoapObject对象,传入所要调用的Web Service的命名空间,Web Service方法名 SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); //将 soapObject对象设置为SoapSerializationEnvelope对象的传出SOAP消息 envelope.bodyOut = soapObject; /** * 因为什么这个网站是通过.NET对外提供Web Service的, * 因此设置与.Net提供的Web Service保持较好的兼容性 */ envelope.dotNet = true; try { // 调用Web Service ht.call(SERVICE_NS + methodName, envelope); if (envelope.getResponse() != null) { // 获取服务器响应返回的SOAP消息 SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); // 解析服务器响应的SOAP消息。 return parseProvinceOrCity(detail); } } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } // 根据省份获取城市列表 public static List<String> getCityListByProvince(String province) { /** * 调用的方法 * 获得支持的城市/地区名称和与之对应的ID 输入参数:theRegionCode = 省市、国家ID或名称,返回数据:一维字符串数组。 如:输入北京的theRegionCode:311101得到的返回结果为: <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>北京,792</string> <string>昌平,785</string> <string>大兴,826</string> <string>房山,827</string> <string>怀柔,752</string> <string>门头沟,788</string> <string>密云,751</string> <string>平谷,756</string> <string>顺义,741</string> <string>通州,3409</string> <string>延庆,746</string> <string>海淀,742</string> <string>朝阳,3408</string> <string>丰台,795</string> <string>石景山,794</string> </ArrayOfString> */ String methodName = "getSupportCityString"; // 创建HttpTransportSE传输对象 HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; // 实例化SoapObject对象 SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); // 添加一个请求参数 soapObject.addProperty("theRegionCode", province); // 使用SOAP1.1协议创建Envelop对象 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.bodyOut = soapObject; // 设置与.Net提供的Web Service保持较好的兼容性 envelope.dotNet = true; try { // 调用Web Service ht.call(SERVICE_NS + methodName, envelope); if (envelope.getResponse() != null) { // 获取服务器响应返回的SOAP消息 SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); // 解析服务器响应的SOAP消息。 return parseProvinceOrCity(detail); } } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } // 解析服务器响应的SOAP消息。 private static List<String> parseProvinceOrCity(SoapObject detail) { List<String> result = new ArrayList<String>(); for (int i = 0; i < detail.getPropertyCount(); i++) { // 解析出每个省份 result.add(detail.getProperty(i).toString().split(",")[0]); } return result; } // 根据城市获取城市具体天气情况 public static SoapObject getWeatherByCity(String cityName) { String methodName = "getWeather"; HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); soapObject.addProperty("theCityCode", cityName); envelope.bodyOut = soapObject; // 设置与.Net提供的Web Service保持较好的兼容性 envelope.dotNet = true; try { ht.call(SERVICE_NS + methodName, envelope); SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); return detail; } catch (Exception e) { e.printStackTrace(); } return null; } } ``` 下边是报错内容 ``` 2019-12-22 15:35:47.617 29228-29259/? W/System.err: java.io.IOException: Stream closed 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:151) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:334) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.readDebug(HttpTransportSE.java:299) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:261) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.WebServicerUtil.getWeatherByCity(WebServicerUtil.java:205) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather.showWeather(MyWeather.java:147) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather.access$200(MyWeather.java:21) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather$3$1.run(MyWeather.java:125) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at java.lang.Thread.run(Thread.java:761) 2019-12-22 15:35:47.619 29228-29259/? E/AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.example.weather, PID: 29228 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object org.ksoap2.serialization.SoapObject.getProperty(int)' on a null object reference at com.example.weather.MyWeather.showWeather(MyWeather.java:150) at com.example.weather.MyWeather.access$200(MyWeather.java:21) at com.example.weather.MyWeather$3$1.run(MyWeather.java:125) at java.lang.Thread.run(Thread.java:761) 2019-12-22 15:35:47.684 29228-29251/? D/EGL_emulation: eglMakeCurrent: 0xa26a6a60: ver 3 0 (tinfo 0xa461a8d0) ```
BufferedInputStream缓存区问题
BufferedInputStream bufferedInputStream = new BufferedInputStream( new FileInputStream(srcFile)); byte[] data = new byte[8192]; while(bufferedInputStream.read(data) != -1) { bufferedOutputStream.write(data); } 问: BufferedInputStream自带8192缓存区 为什么书上的例子却申请了字节数组data,然后调用bufferedInputStream.read(data)方法 这样并不能证明整个读取过程起到缓存作用的是BufferedInputStream本身自带的缓存区啊 而是证明了我们外部申请的缓存区data。 请各位大虾帮忙解惑
JAVA中导出excel的公用类的方法怎么调用?
1.我想导出前端查询后的数据,然后将数据导出到excel中,在网上查到有一个公用的方法,我创建了,但是我不会调用。请各位大神帮助下,谢谢了。刚开始学习java的小白。 2.疑问:controller(这个不会写)怎么调用这个方法呢? 3.环境:Java后端+vue前端(前端过滤后的数据进行导出) 如下为controller,这个确实不会写,请各位大神帮助下。谢谢。 ``` @RequestMapping("/exportExcel") //@ApiOperation("数据导出excel") @ResponseBody public R download(@RequestParam Map<String, Object> params){ //exportSsExcel(String tempPath, String path, HttpServletResponse response, List<T> list, int count) //获取日期类型根据类型分发业务 String energy_name = MapUtil.getStr(map,"tempPath"); String to_build = MapUtil.getStr(map,"path"); } ``` 如下为共用类ExcelUtils中的导出方法。 ``` public void exportSsExcel(String tempPath, String path, HttpServletResponse response, List<T> list, int count) { File newFile = createNewFile(tempPath, path); InputStream is = null; HSSFWorkbook workbook = null; HSSFSheet sheet = null; try { is = new FileInputStream(newFile);// 将excel文件转为输入流 workbook = new HSSFWorkbook(is);// 创建个workbook, // 获取第一个sheet sheet = workbook.getSheetAt(0); } catch (Exception e1) { e1.printStackTrace(); } if (sheet != null) { try { // 写数据 FileOutputStream fos = new FileOutputStream(newFile); HSSFRow row = sheet.getRow(0); if (row == null) { row = sheet.createRow(0); } HSSFCell cell = row.getCell(0); if (cell == null) { cell = row.createCell(0); } //cell.setCellValue("我是标题"); for (int i = 0; i < list.size(); i++) { T vo1 = list.get(i); row = sheet.createRow(i+count); //从第count行开始 //这里就可以使用sysUserMapper,做相应的操作 Field[] fields=vo1.getClass().getDeclaredFields(); for(int j=0;j<fields.length;j++){ String firstLetter = fields[j].getName().substring(0, 1).toUpperCase(); String getter = "get" + firstLetter + fields[j].getName().substring(1); Method method = vo1.getClass().getMethod(getter, new Class[] {}); if(fields[j].getGenericType().toString().equals("class java.util.Date")){ Object value =method.invoke(vo1, new Object[] {}); if(value!=null){ Date date =(Date)value; createRowAndCell(format.format(date), row, cell, j); }else { createRowAndCell(value, row, cell, j); } }else { createRowAndCell(method.invoke(vo1, new Object[] {}), row, cell, j); } } } workbook.write(fos); fos.flush(); fos.close(); // 下载 InputStream fis = new BufferedInputStream(new FileInputStream( newFile)); byte[] buffer = new byte[fis.available()]; fis.read(buffer); fis.close(); response.reset(); response.setContentType("text/html;charset=UTF-8"); OutputStream toClient = new BufferedOutputStream( response.getOutputStream()); response.setContentType("application/x-msdownload"); String newName = URLEncoder.encode( "防火漏电" + System.currentTimeMillis() + ".xls", "UTF-8"); response.addHeader("Content-Disposition", "attachment;filename=\"" + newName + "\""); response.addHeader("Content-Length", "" + newFile.length()); toClient.write(buffer); toClient.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (null != is) { is.close(); } } catch (Exception e) { e.printStackTrace(); } } } // 删除创建的新文件 this.deleteFile(newFile); } ```
android开发字节转为String乱码问题
PrintStream out = new PrintStream( client.getOutputStream()); // 打印流输出 out.println("啊啊"); System.out.println("设置完"); BufferedInputStream buf = new BufferedInputStream( client.getInputStream()); // 缓冲区读取 // 发送数据 byte by[]=new byte[1024]; /*for(int i=0;i<by.length;i++){ by[i]=(byte) buf.read(); }*/ int byint = -1; int w = 0; while ((byint = buf.read()) != -1) { by[w] = (byte) byint;//将读取的整型转换为byte类型,并将此字节放入字节数组中。 w++; } String s=new String(by,"UTF-8"); System.out.println("字节流"+s); String sr=s.trim(); //BufferedReader br=new BufferedReader(new InputStreamReader(buf,"UTF-8")); MyClientDemo.this.info.setText(sr); /*while((s=br.readLine())!=null){ System.out.println("s有字符"); System.out.println("接收到"+s); }*/ // 设置文本 out.close(); // 关闭输出流 //buf.close() ; // 关闭输入流 client.close(); 无论是先把字节流转换为字符流的方式,还是把以byte的方式在String里进行转换都不行,服务端正常显示没有乱码,是UTF-8
小白课设第一次编程Java,这里出错怎么办
第一次学习java,以下是整个程序段,出错那里应该怎么改。 ``` package util; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.http.HttpServletRequest; import model.User; import org.apache.tools.zip.ZipEntry; import org.apache.tools.zip.ZipOutputStream; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import dao.UserDao; public class Util { public static String getTime2() { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); Date date = new Date(); return sdf.format(date.getTime()); } public static String getTime() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return sdf.format(date.getTime()); } public static String getRiqi() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); return sdf.format(date.getTime()); } public static String getYuefen() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); Date date = new Date(); return sdf.format(date.getTime()); } // 上传文件/复制文件。 public static void copyFile(File src, File dst) { try { int BUFFER_SIZE = 16 * 1024; InputStream in = null; OutputStream out = null; try { in = new BufferedInputStream(new FileInputStream(src), BUFFER_SIZE); out = new BufferedOutputStream(new FileOutputStream(dst), BUFFER_SIZE); byte[] buffer = new byte[BUFFER_SIZE]; for (int byteRead = 0; (byteRead = in.read(buffer)) > 0;) { out.write(buffer, 0, byteRead); } } finally { if (null != in) { in.close(); } if (null != out) { out.close(); } } } catch (Exception e) { e.printStackTrace(); } } public static void createZip(String src, String nilename, String path) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zipOut = new ZipOutputStream(bos); zipOut.setEncoding("gbk"); File file = new File(path, src); byte[] buffer = new byte[4096]; int bytes_read; InputStream fis = new FileInputStream(file); zipOut.putNextEntry(new ZipEntry(src)); while ((bytes_read = fis.read(buffer)) != -1) { zipOut.write(buffer, 0, bytes_read); } zipOut.closeEntry(); fis.close(); zipOut.close(); FileOutputStream fout = new FileOutputStream(new File(path, nilename)); bos.writeTo(fout); fout.flush(); fout.close(); } //初始化系统 public static void init(HttpServletRequest request){ WebApplicationContext app = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext()); UserDao userDao = (UserDao)app.getBean("userDao"); User user = userDao.selectBean(" where username='admin' and userlock=0 "); if(user==null){ user = new User(); user.setPassword("111111"); user.setRole(1); user.setTruename("admin"); user.setUsername("admin"); userDao.insertBean(user); } } } ``` ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578016411_198621.png) ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578017373_802226.png)
java以字符流的形式清洗超大文本
我用 BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("D:\\ccc.txt")),"UTF-8")); BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file)); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream),5*1024*1024);方式清洗大约2G的文本,也是会包内存不足![图片说明](https://img-ask.csdn.net/upload/201808/17/1534476695_368359.png) 上面是清洗之前的 下面是清洗之后的![图片说明](https://img-ask.csdn.net/upload/201808/17/1534476753_986215.png) 问了其他人,说字符流可以实现,要怎么实现,麻烦详细些,谢谢
url传参为空怎么解决?
url=append+'/report/download2.do?name='+name传到后台name为空。 js ``` $("#btn_his_download").on("click", function () { var name = $("#lines").find("option:selected").text(); var $form = $('<form method="GET"></form>'); $form.attr('action', appName + '/report/download2.do?name='+name); $form.appendTo($('body')); $form.submit(); }); ``` controller ``` @RequestMapping("/download2.do") public void download2(HttpServletRequest request, HttpServletResponse response) throws IOException { String name = request.getParameter("name"); System.out.println(name); String fileName = request.getSession().getServletContext().getRealPath("tcc/reports/upload/")+name; InputStream bis = new BufferedInputStream(new FileInputStream(new File(fileName))); name = URLEncoder.encode(name,"UTF-8"); response.addHeader("Content-Disposition", "attachment;filename=" + name); response.setContentType("multipart/form-data"); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); int len = 0; while((len = bis.read()) != -1){ out.write(len); out.flush(); } out.close(); } ```
InputStreamReader和BufferedInputStream分别是什么,有什么区别
InputStreamReader和BufferedInputStream分别是什么,有什么区别java
FileInputStream跟BufferedInputStream的区别?
``` 听说BufferedInputStream有缓冲区,所以效率高,可是InputStream也有呀, 差距体现在哪里? ```
急急急 java 实现把bmp转换一个dcm文件,但是生成dcm文件却无法打开,求助.
代码如下 ``` import org.dcm4che3.data.Attributes; import org.dcm4che3.data.Tag; import org.dcm4che3.data.VR; import org.dcm4che3.io.DicomEncodingOptions; import org.dcm4che3.io.DicomOutputStream; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; public class TwoBmp2Dcm { private static byte[] buffer = new byte[54]; private static byte[] buff = new byte[8192]; private static int imageSize; private static DicomEncodingOptions encOpts = DicomEncodingOptions.DEFAULT; public static void main(String[] args) throws Exception { File file=new File("/Users/zhangdechang/Desktop/txt/timg.bmp"); File outdcm=new File("/Users/zhangdechang/Desktop/txt/998uuuu.dcm"); DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(file))); DicomOutputStream out =new DicomOutputStream(outdcm); Attributes attrs=new Attributes(); Attributes data=new Attributes(); attrs=addMetaInformation(attrs); data=addData(data); data=readHeader(data, dis); out.writeDataset(attrs, data); out.setEncodingOptions(encOpts); out.writeHeader(Tag.PixelData, VR.OW, imageSize*2); int r; while ((r = dis.read(buff)) > 0) { out.write(buff, 0, r); } out.close(); dis.close(); } public static Attributes readHeader(Attributes attrs ,DataInputStream dis) throws Exception{ dis.read(buffer,0,54); if((buffer[0]&0xff)!=0x42&&(buffer[1]&0xff)!=0x4d){ throw new Exception("Missing BM segment in Bmp stream"); } int imageRows=byteToInt(buffer,21); int imageColumns=byteToInt(buffer,25); imageSize=byteToInt(buffer,5)-54; int biBitCount=byteTo2Int(buffer,29); attrs.setInt (Tag.SamplesPerPixel, VR.US,3); attrs.setInt(Tag.Rows, VR.US, imageColumns<0?-imageColumns:imageColumns); attrs.setInt(Tag.Columns, VR.US, imageRows); attrs.setInt(Tag.BitsAllocated, VR.US,biBitCount );//biBitCount attrs.setInt(Tag.BitsStored, VR.US,32); attrs.setInt(Tag.HighBit, VR.US, 32); attrs.setInt(Tag.PixelRepresentation, VR.US, 0); attrs.setString(Tag.PhotometricInterpretation,VR.CS, "MONOCHROME2"); //PALETTE_COLOR MONOCHROME2 attrs.setString(Tag.RescaleSlope, VR.DS, "1.0"); attrs.setString(Tag.RescaleIntercept, VR.DS, "0.0"); attrs.setString(Tag.PixelSpacing,VR.DS, "0.25/0.25"); attrs.setInt(Tag.NumberOfFrames, VR.IS, 1); return attrs; } public static Attributes addData(Attributes attrs){ attrs.setString(Tag.SpecificCharacterSet, VR.CS, "GB18030"); attrs.setString(Tag.ImageType, VR.CS, "ORIGINAL/PRIMARY/AXIAL"); attrs.setString(Tag.InstanceCreationDate, VR.DA, "20130013"); attrs.setString(Tag.InstanceCreationTime, VR.TM, "175827"); attrs.setString(Tag.SOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.2"); attrs.setString(Tag.SOPInstanceUID, VR.UI, "1.3.6.1.4.1.30071.6.22744165.4288391077912169.1.3"); attrs.setString(Tag.StudyDate, VR.DA, "20130803"); attrs.setString(Tag.AcquisitionDateTime, VR.DT, "20130803000000"); attrs.setString(Tag.StudyTime, VR.TM, "175532"); attrs.setString(Tag.AccessionNumber, VR.SH, "0"); attrs.setString(Tag.Modality, VR.CS, "DX"); attrs.setString(Tag.Manufacturer, VR.LO, "LargeV"); attrs.setString(Tag.StudyDescription, VR.LO, "融合扫描图像"); attrs.setString(Tag.SeriesDescription, VR.LO, "融合扫描图像"); attrs.setString(Tag.ManufacturerModelName, VR.LO, "HighRes3D"); attrs.setString(Tag.PatientName, VR.PN, "mmmm"); attrs.setString(Tag.PatientBirthDate,VR.DA,"19920720"); attrs.setString(Tag.PatientSex, VR.CS, "F"); return attrs; } public static Attributes addMetaInformation( Attributes attrs){ attrs.setString(Tag.FileMetaInformationVersion, VR.OB, ""); attrs.setString(Tag.MediaStorageSOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.2"); attrs.setString(Tag.MediaStorageSOPInstanceUID, VR.UI, "1.3.6.1.4.1.30071.6.22744165.4288391077912169.1.18"); attrs.setString(Tag.TransferSyntaxUID, VR.UI, "1.2.840.10008.1.2.1"); attrs.setString(Tag.ImplementationVersionName, VR.SH, "SmartVDicom1.0"); attrs.setString(Tag.ImplementationClassUID, VR.UI, "1.3.6.1.4.1.30071.6"); attrs.setString(Tag.SourceApplicationEntityTitle, VR.AE, ""); return attrs; } public static int byteToInt(byte[] bi,int end){ int a=(((int)bi[end]&0xff)<<24) ; int b=(((int)bi[end-1]&0xff)<<16) ; int c=(((int)bi[end-2]&0xff)<<8) ; int d=(int)bi[end-3]&0xff; return a+b+c+d; } public static int byteTo2Int(byte[] bi,int end){ int c=(((int)bi[end]&0xff)<<8) ; int d=(int)bi[end-1]&0xff; return c+d; } } ``` 生成的dcm文件打开报错,无法打开。 ![图片说明](https://img-ask.csdn.net/upload/201912/17/1576562077_220062.jpeg) 需要依赖的jar ``` <dependency> <groupId>com.sun.media</groupId> <artifactId>clibwrapper_jiio</artifactId> <version>1.2-pre-dr-b04</version> </dependency> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-audit</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-api</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-core</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-core-api</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-dicom</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-core</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-emf</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-filecache</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-hl7</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-image</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-json</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-mime --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-mime</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-net</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-net-audit --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-net-audit</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-net-hl7</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-soundex --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-soundex</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2dcm</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcm2jpg --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2jpg</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcm2json --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2json</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2xml</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmdict --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmdict</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmdir --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmdir</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmdump</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmgen --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmgen</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmqrscp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmqrscp</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmvalidate</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-emf2sf --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-emf2sf</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-findscu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-findscu</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-getscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-hl7pix --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl7pix</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-hl7rcv --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl7rcv</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-hl7snd --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl7snd</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl72xml</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-ianscp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-ianscp</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-ianscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool.ihe/dcm4che-tool-ihe-modality --> <dependency> <groupId>org.dcm4che.tool.ihe</groupId> <artifactId>dcm4che-tool-ihe-modality</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-jpg2dcm --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-jpg2dcm</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-json2dcm</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-mkkos --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-mkkos</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-movescu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-movescu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-mppsscp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-mppsscp</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-mppsscu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-mppsscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-prefs2xml --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-prefs2xml</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-qc --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-qc</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-qidors</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-stgcmtscu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-stgcmtscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-storescp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-storescp</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-storescu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-storescu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-stowrs --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-stowrs</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-syslog</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-syslogd --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-syslogd</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-wadors --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-wadors</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-wadouri --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-wadouri</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-xml2dcm</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-xml2hl7 --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-xml2hl7</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-xml2prefs --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-xml2prefs</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-ws-rs --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-ws-rs</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.glassfish/javax.json --> <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.json</artifactId> <version>1.0.4</version> </dependency> <dependency> <groupId>javax.json</groupId> <artifactId>javax.json-api</artifactId> <version>1.1.4</version> </dependency> <!-- https://mvnrepository.com/artifact/log4j/log4j --> <!--<dependency>--> <!--<groupId>log4j</groupId>--> <!--<artifactId>log4j</artifactId>--> <!--<version>1.2.17</version>--> <!--</dependency>--> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.25</version> </dependency> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.25</version> </dependency> <!-- 倒入jar --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-imageio</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-imageio-rle</artifactId> <version>5.17.0</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-imageio-opencv</artifactId> <version>5.17.0</version> <scope>runtime</scope> </dependency> <!--<dependency>--> <!--<groupId>com.sun.media</groupId>--> <!--<artifactId>jai_imageio</artifactId>--> <!--<version>1.2-pre-dr-b04</version>--> <!--<scope>runtime</scope>--> <!--</dependency>--> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-common</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> ```
使用CXF发布Rest服务 出现read time out错误
CXF版本:2.3.0 现象:偶尔出现连接超时,但不是必现,不知道是否有高手遇到过类似的错误 部分异常信息: ``` [1127 10:55:38 480 WARN ] [http-bio-9095-exec-9] cxf.phase.PhaseInterceptorChain - Interceptor for {http://localhost:9091/test/ws}WebClient has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:616) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:596) at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:324) at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:360) at com.neusoft.acorn.apps.terminal.application.internal.ExamEndSignServiceImpl.saveExamEndSignInfo(ExamEndSignServiceImpl.java:34) at com.neusoft.acorn.protocol.terminal.ExamEndSignSubmitData.saveExamEndSignInfo(ExamEndSignSubmitData.java:1208) at com.neusoft.acorn.protocol.terminal.FunctionSubmitALLCheckData.getReturnXmlValue(FunctionSubmitALLCheckData.java:102) at com.neusoft.acorn.protocol.terminal.TRMDataExchange.dmClient(TRMDataExchange.java:150) at com.neusoft.acorn.protocol.terminal.TRMDataExchange.doGetPost(TRMDataExchange.java:86) at com.neusoft.acorn.protocol.terminal.TRMDataExchange.doPost(TRMDataExchange.java:67) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1136) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://localhost:9091/test/ws/dailyTestAssemble/putExamEndSign.xml: Read timed out at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1995) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1980) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:662) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 37 more Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) at java.io.BufferedInputStream.read(BufferedInputStream.java:334) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:690) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1324) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2102) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2071) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1925) ... 40 more ```
当输出0000000000000后停止运行要如何处理?
如下代码: String url = "http://www.xxx.com/xxx/downloadFile/" + filename + "." + format; loadQianURL("Desktop",url); /** * 文件或文件夹不存在则创建 * @param dir 文件夹 * @param filepath 文件名 */ public static void createDirFile(String dir){ File file = new File(dir); if(!file.exists()){ file.mkdirs(); } } /** * @param dir 子目录 * @param fileUrl 图片链接 * @return */ public static String loadQianURL(String dir,String fileUrl) { //获取文件名,文件名实际上在URL中可以找到 String fileName = fileUrl.substring(fileUrl.lastIndexOf("/")+1,fileUrl.length()); //这里服务器上要将此图保存的路径 String savePath = "D:/upload/"; if (!StringUtils.isEmpty(dir)){ savePath = savePath +dir+"/"; } createDirFile(savePath); try { /*将网络资源地址传给,即赋值给url*/ URL url = new URL(fileUrl); /*此为联系获得网络资源的固定格式用法,以便后面的in变量获得url截取网络资源的输入流*/ HttpURLConnection connection = (HttpURLConnection)url.openConnection(); //服务器的安全设置不接受Java程序作为客户端访问,解决方案是设置客户端的User Agent connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); System.out.println("0000000000000000000000000000"); DataInputStream in = new DataInputStream(connection.getInputStream()); System.out.println("111111111111111111111111111111"); /*此处也可用BufferedInputStream与BufferedOutputStream*/ DataOutputStream out = new DataOutputStream(new FileOutputStream(savePath+fileName)); /*将参数savePath,即将截取的图片的存储在本地地址赋值给out输出流所指定的地址*/ byte[] buffer = new byte[4096]; int count = 0; /*将输入流以字节的形式读取并写入buffer中*/ while ((count = in.read(buffer)) > 0) { out.write(buffer, 0, count); } out.close();/*后面三行为关闭输入输出流以及网络资源的固定格式*/ in.close(); connection.disconnect(); //返回内容是保存后的完整的URL /*网络资源截取并存储本地成功返回true*/ return savePath+fileName; } catch (Exception e) { System.out.println(e + fileUrl + savePath); return null; } } 运行结果:2019-10-22 16:43:55.545 2f1aa58b I: 0000000000000000000000000000 java.io.FileNotFoundException: http://www.xxx.com/xxx/downloadFile/1二维码.png 输出0000000000000后停止运行要如何处理?
如何读取csv文件的编码格式?(该问题已解决,答案在我自己的评论中)
目前有一个方法去获取csv文件的编码格式,但是当csv文件为UTF8时,读取出的结果是GBK, > ``` public static String codeString(String fileName) throws Exception { > BufferedInputStream bin = new BufferedInputStream(new FileInputStream(fileName)); > int p = (bin.read() << 8) + bin.read(); > bin.close(); > String code = null; > > switch (p) { > case 0xefbb: > code = "UTF-8"; > break; > case 0xfffe: > code = "Unicode"; > break; > case 0xfeff: > code = "UTF-16BE"; > break; > default: > code = "GBK"; > } > > return code; } ``` 目前的原因应该是“p”的问题![图片说明](https://img-ask.csdn.net/upload/201910/15/1571119875_642470.jpg) ![图片说明](https://img-ask.csdn.net/upload/201910/15/1571119190_69450.png) 这个地方就直接判断成了GBK,有没有大佬能给个判断编码格式的代码
springBoot集成ckfinder3,按照官网案例,集成到项目就出现无法加载CKFinder配置,请大佬们解答下,感谢!
## springBoot集成ckfinder3,按照官网案例,集成到项目出现无法加载CKFinder配置,请大佬们解答下,感谢! ![图片说明](https://img-ask.csdn.net/upload/201911/28/1574950542_300362.png)![图片说明](https://img-ask.csdn.net/upload/201911/28/1574950556_903098.png) ![图片说明](https://img-ask.csdn.net/upload/201911/28/1574950569_168466.png) [restartedMain] ERROR c.c.c.c.ConfigFactory$$EnhancerBySpringCGLIB$$85ae45bc - [<init>,73] - Could not load CKFinder configuration com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "enabled" (class com.cksource.ckfinder.config.Config), not marked as ignorable (15 known properties: "cache", "thumbnails", "serveStaticResources", "privateDir", "resourceTypes", "licenseName", "secureImageUploads", "checkSizeAfterScaling", "extraHeaders", "images", "accessControl", "roleSessionAttribute", "csrfProtection", "licenseKey", "backends"]) at [Source: (BufferedInputStream); line: 3, column: 14] (through reference chain: com.cksource.ckfinder.config.Config["enabled"]) at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:60) at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:823) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1153) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1589) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1567) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3070) at com.cksource.ckfinder.config.loader.YamlConfigLoader.loadConfig(YamlConfigLoader.java:32) at com.cksource.ckfinder.config.ConfigFactory.<init>(ConfigFactory.java:64) at com.cksource.ckfinder.config.ConfigFactory$$EnhancerBySpringCGLIB$$85ae45bc.<init>(<generated>) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1154) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:392) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) at com.cksource.ckfinder.servlet.CKFinderServlet.init(CKFinderServlet.java:180) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1124) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:974) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.load(TomcatEmbeddedContext.java:83) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:2897) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.lambda$deferredLoadOnStartup$0(TomcatEmbeddedContext.java:65) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.doWithThreadContextClassLoader(TomcatEmbeddedContext.java:108) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:64) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.performDeferredLoadOnStartup(TomcatWebServer.java:282) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:200) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:311) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:164) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at com.zhglxt.ZhglxtApplication.main(ZhglxtApplication.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 21:56:27.856 [restartedMain] WARN o.s.w.c.s.AnnotationConfigWebApplicationContext - [refresh,554] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'CKFinder': Unsatisfied dependency expressed through field 'baseConfig'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.cksource.ckfinder.config.Config' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=baseConfig)} 21:56:27.859 [restartedMain] ERROR o.a.c.c.C.[.[.[/zhglxt] - [log,175] - StandardWrapper.Throwable org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'CKFinder': Unsatisfied dependency expressed through field 'baseConfig'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.cksource.ckfinder.config.Config' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=baseConfig)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) at com.cksource.ckfinder.servlet.CKFinderServlet.init(CKFinderServlet.java:180) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1124) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:974) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.load(TomcatEmbeddedContext.java:83) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:2897) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.lambda$deferredLoadOnStartup$0(TomcatEmbeddedContext.java:65) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.doWithThreadContextClassLoader(TomcatEmbeddedContext.java:108) at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:64) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.performDeferredLoadOnStartup(TomcatWebServer.java:282) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:200) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:311) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:164) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at com.zhglxt.ZhglxtApplication.main(ZhglxtApplication.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.cksource.ckfinder.config.Config' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=baseConfig)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1644) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1242) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 47 common frames omitted 21:56:27.861 [restartedMain] INFO o.a.c.h.Http11NioProtocol - [log,173] - Pausing ProtocolHandler ["http-nio-8888"] 21:56:27.973 [restartedMain] INFO o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat] 21:56:27.979 [restartedMain] INFO o.a.c.h.Http11NioProtocol - [log,173] - Stopping ProtocolHandler ["http-nio-8888"] 21:56:27.986 [restartedMain] INFO o.a.c.h.Http11NioProtocol - [log,173] - Destroying ProtocolHandler ["http-nio-8888"] 21:56:28.390 [Quartz Scheduler [ZhglxtScheduler]] INFO o.q.c.QuartzScheduler - [start,547] - Scheduler ZhglxtScheduler_$_ZXW-20170610XKD1574949376093 started. 21:56:28.790 [restartedMain] ERROR o.s.b.d.LoggingFailureAnalysisReporter - [report,42] - *************************** APPLICATION FAILED TO START *************************** Description: Field baseConfig in com.cksource.ckfinder.CKFinder required a bean of type 'com.cksource.ckfinder.config.Config' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) - @org.springframework.beans.factory.annotation.Qualifier(value=baseConfig) Action: Consider defining a bean of type 'com.cksource.ckfinder.config.Config' in your configuration.
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
Android 9.0系统新特性,对刘海屏设备进行适配
其实Android 9.0系统已经是去年推出的“老”系统了,这个系统中新增了一个比较重要的特性,就是对刘海屏设备进行了支持。一直以来我也都有打算针对这个新特性好好地写一篇文章,但是为什么直到拖到了Android 10.0系统都发布了才开始写这篇文章呢?当然,一是因为我这段时间确实比较忙,今年几乎绝大部分的业余时间都放到写新书上了。但是最主要的原因并不是这个,而是因为刘海屏设备的适配存在一定的特殊性
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
日均350000亿接入量,腾讯TubeMQ性能超过Kafka
整理 | 夕颜出品 | AI科技大本营(ID:rgznai100) 【导读】近日,腾讯开源动作不断,相继开源了分布式消息中间件TubeMQ,基于最主流的 OpenJDK8开发的
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
相关热词 c# plc s1200 c#里氏转换原则 c# 主界面 c# do loop c#存为组套 模板 c# 停掉协程 c# rgb 读取图片 c# 图片颜色调整 最快 c#多张图片上传 c#密封类与密封方法
立即提问