⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httputils.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
////  HttpUtils//  EV      19.12.2000////  getRemoteFileContents//package org.jahia.utils;import java.io.*;                       // File access methodsimport java.io.*;					    // IOExceptionimport java.net.*;					    // HttpURLConnectionimport org.jahia.exceptions.JahiaException;;public class HttpUtils {    private static  HttpUtils   theObject = null;    /***        * constructor	    * EV    19.12.2000        *        */	private HttpUtils()	{	    JahiaConsole.println( "Utils", "***** Starting HttpUtils *****" );	} // end constructor    /***        * getInstance	    * EV    19.12.2000        *        */	public static HttpUtils getInstance()	{	    if (theObject == null) {	        theObject = new HttpUtils();	    }	    return theObject;	} // end getInstance    /***        * getRemoteFileContents	    * EV    03.12.2000	    * called by NewsFeedServices.getNewsFeed(), DataSourceServices        *        */	public String getRemoteFileContents( String urlPath )	{	    try {            URL url             = new URL( urlPath );            InputStreamReader input = new InputStreamReader( (InputStream) url.openStream() );            BufferedReader in = new BufferedReader( (Reader) input );            String contents = "";            String buffer = "";            while ((buffer = in.readLine()) != null) {       	        contents += buffer + "\n";            }            return contents;	    } catch (IOException ie) {            String errorMsg = "Error in reading newsfeed " + urlPath + " : " + ie.getMessage();            JahiaConsole.println( "NewsFeedManager", errorMsg + " -> Error !" );            JahiaException je = new JahiaException(   "Cannot access to newsfeed",                                                errorMsg, JahiaException.FILE_ERROR, JahiaException.ERROR );            return "- No NewsFeed ! -";	    }	} // end getRemoteFileContents} // end HttpUtils

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -