当前位置: 首页>>代码示例>>Java>>正文


Java PrintWriter.append方法代码示例

本文整理汇总了Java中java.io.PrintWriter.append方法的典型用法代码示例。如果您正苦于以下问题:Java PrintWriter.append方法的具体用法?Java PrintWriter.append怎么用?Java PrintWriter.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.PrintWriter的用法示例。


在下文中一共展示了PrintWriter.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteOssData

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * 删除当前网站内的文件,删除OSS存储的数据
 * @param fileName 传入oss的key,如345.html、news/asd.jpg
 */
@RequestMapping("deleteOssData")
public void deleteOssData(Model model,HttpServletResponse response,
		@RequestParam(value = "fileName", required = true) String fileName){
	fileName = filter(fileName);
	AttachmentFile.deleteObject("site/"+getSiteId()+"/"+fileName);
	
	AliyunLog.addActionLog(getSiteId(), "删除当前网站内存储的文件:"+fileName);
	
	JSONObject json = new JSONObject();
	json.put("result", "1");
	response.setCharacterEncoding("UTF-8");  
    response.setContentType("application/json; charset=utf-8");  
    PrintWriter out = null;  
    try { 
        out = response.getWriter();  
        out.append(json.toString());
    } catch (IOException e) {  
        e.printStackTrace();  
    } finally {  
        if (out != null) {  
            out.close();  
        }  
    }  
}
 
开发者ID:xnx3,项目名称:wangmarket,代码行数:29,代码来源:SiteController.java

示例2: popupQrImageUpdateSubmit

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * 通用电脑模式,更改底部的二维码,提交保存
 */
@RequestMapping(value = "popupQrImageUpdateSubmit")
public void popupQrImageUpdateSubmit(Model model,HttpServletRequest request,HttpServletResponse response,
		@RequestParam("qrImageFile") MultipartFile multipartFile) throws IOException{
	JSONObject json = new JSONObject();
	Site site = getSite();
	
	if(!(multipartFile.getContentType().equals("image/pjpeg") || multipartFile.getContentType().equals("image/jpeg") || multipartFile.getContentType().equals("image/png") || multipartFile.getContentType().equals("image/gif"))){
		json.put("result", "0");
		json.put("info", "请传入jpg、png、gif格式的二维码图");
	}else{
		//格式转换
		BufferedImage bufferedImage = ImageUtil.inputStreamToBufferedImage(multipartFile.getInputStream());
        BufferedImage tag = ImageUtil.formatConversion(bufferedImage);
        BufferedImage tag1 = ImageUtil.proportionZoom(tag, 400);
		
		//上传
        AttachmentFile.put("site/"+site.getId()+"/images/qr.jpg", ImageUtil.bufferedImageToInputStream(tag1, "jpg"));
		
		AliyunLog.addActionLog(getSiteId(), "通用电脑模式,更改底部的二维码,提交保存");
		
		json.put("result", "1");
	}
	
	response.setCharacterEncoding("UTF-8");  
    response.setContentType("application/json; charset=utf-8");  
    PrintWriter out = null;  
    try {  
        out = response.getWriter();  
        out.append(json.toString());
    } catch (IOException e) {  
        e.printStackTrace();  
    } finally {  
        if (out != null) {  
            out.close();  
        }  
    }  
}
 
开发者ID:xnx3,项目名称:wangmarket,代码行数:41,代码来源:SiteController.java

示例3: out

import java.io.PrintWriter; //导入方法依赖的package包/类
public void out(WebRequest r,Object metadata,OutputStream s)
{
	PrintWriter pw = new PrintWriter( s );
	int ind = r.path.indexOf("/");
	String concept = r.path.substring(ind+1);
	//list the concepts
	pw.append("<h1>"+concept+"</h1>");

	pw.append("<h2>Instances</h2>");
	//the default taxonomy
	//view all the maps, objects etc. as lists
	File instsdir = new File("Concepts/"+concept+"/Instances");
	String[] insts = instsdir.list();
	for(int i=0;i<insts.length;i++)
	{
		String inst = insts[i];
		if(inst.startsWith(".")||inst.endsWith(".md"))
		{
			continue;
		}
		
		pw.append("<a href=\"/EditObjectInstance.html/"+concept+"/"+inst+"\">"+inst+"</a><br>");
	}
	pw.flush();
}
 
开发者ID:johndavidbustard,项目名称:RoughWorld,代码行数:26,代码来源:ViewObjectConcept.java

示例4: doGet

import java.io.PrintWriter; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    resp.setBufferSize(bufferSize);

    resp.setContentType("text/plain");
    resp.setCharacterEncoding("UTF-8");
    resp.setContentLength(responseSize);

    PrintWriter pw = resp.getWriter();
    for (int i = 0; i < responseSize; i++) {
        pw.append('X');
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:TestAbstractAjpProcessor.java

示例5: out

import java.io.PrintWriter; //导入方法依赖的package包/类
public void out(WebRequest r,Object metadata,OutputStream s)
{
	PrintWriter pw = new PrintWriter( s );
	int ind = r.path.indexOf("/");
	String concept = r.path.substring(ind+1);
	//list the concepts
	pw.append("<h1>"+concept+"</h1>");

	pw.append("<h2>Instances</h2>");
	//the default taxonomy
	//view all the maps, objects etc. as lists
	File instsdir = new File("Concepts/"+concept+"/Instances");
	String[] insts = instsdir.list();
	for(int i=0;i<insts.length;i++)
	{
		String inst = insts[i];
		if(inst.startsWith(".")||inst.endsWith(".md"))
		{
			continue;
		}
		
		pw.append("<a href=\"/EditMapInstance.html/"+concept+"/"+inst+"\">"+inst+"</a><br>");
	}
	pw.flush();
}
 
开发者ID:johndavidbustard,项目名称:RoughWorld,代码行数:26,代码来源:ViewMapConcept.java

示例6: handle

import java.io.PrintWriter; //导入方法依赖的package包/类
@Override
protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
    String targetUrl = this.determineTargetUrl(request, response);
    if(response.isCommitted()) {
        this.logger.debug("Response has already been committed. Unable to redirect to " + targetUrl);
    } else {
        ObjectMapper mapper = new ObjectMapper();
        response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
        response.setHeader("Access-Control-Allow-Credentials", "true");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Headers", "X-Request-With, JWCQ, Origin,Content-Type");
        response.setContentType("text/plain;charset='utf-8'");
        response.setCharacterEncoding("UTF-8");
        response.setStatus(200);

        // Our ajax request, redirect it to login web page
        Response response1 = new Response();
        response1.setSuccess(1);
        response1.setMessage("success");
        response1.setResult("登录成功");
        String responseStr = "";
        PrintWriter out = response.getWriter();
        try {
            responseStr = mapper.writeValueAsString(response1);
            out.append(responseStr);
        } catch (IOException ioe) {
            // FIXME: Add log here!
            out.append(ioe.toString());
        }
        out.close();
    }
}
 
开发者ID:luotuo,项目名称:springboot-security-wechat,代码行数:34,代码来源:MyAuthenticationSuccessHandler.java

示例7: logError

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Dispatches given message with {@link Logger#error} and to the {@code STD_ERR} of used output stream. Additionally
 * will print stack trace of the provided throwable.
 */
public void logError(final String message, final Throwable t) {
	LOGGER.error(message, t);
	// Print writer is intentionally not released, its just a wrapper to log a message.
	final PrintWriter pw = new PrintWriter(osProvider.getOutputStream(STD_ERR, OutputRedirection.SUPPRESS));
	pw.append(getTimestamp() + message + lineSeparator());
	if (null != t) {
		pw.append(getTimestamp() + getStackTraceAsString(t) + lineSeparator());
	}
	pw.flush();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:NpmLogger.java

示例8: testRename

import java.io.PrintWriter; //导入方法依赖的package包/类
public void testRename() throws IOException, FileNotFoundException
{
	File testContent = new File(srcFolder, "tmp1");
	PrintWriter pw = new PrintWriter(testContent);
	pw.append("This is my file");
	pw.append("It has 3 lines");
	pw.append("So there");
	pw.close();

	destFolder = new File(tempFolder, "dest");
	Files.move(srcFolder, destFolder);
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:FileUtilsTest.java

示例9: printStackTrace

import java.io.PrintWriter; //导入方法依赖的package包/类
public void printStackTrace(PrintWriter err) {
    super.printStackTrace(err);
    int currentIndex = -1;
    for (Throwable throwable : this.innerThrowables) {
        err.append("\n");
        err.append("  Inner throwable #");
        currentIndex++;
        err.append(Integer.toString(currentIndex));
        err.append(": ");
        throwable.printStackTrace(err);
        err.append("\n");
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:AggregateException.java

示例10: write

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Write.
 *
 * @param out
 *            the out
 */
public void write(OutputStream out) {
	PrintWriter w = new PrintWriter(out);
	String instanceStr = instanceName.replaceAll("[, =]", "\\$1");
	String time = String.valueOf((registry.getMillis() / 1000) * 1000000000);
	for (String type : registry.getTypes()) {
		String typeStr = type.replaceAll("[, ]", "\\$1");
		for (String key : registry.getKeys(type)) {
			String keyStr = key.replaceAll("[, =]", "\\$1");
			String parts[] = typeStr.split("\\.", 3);
			w.print(parts[0]);
			w.print(",host=");
			w.print(instanceStr);
			w.print(",instance=");
			if (parts.length > 1) {
				w.print(parts[1]);
			}
			w.print(",type=");
			if (parts.length > 2) {
				w.append(parts[2]);
			}
			w.print(",type_instance=");
			w.print(keyStr);
			w.print(" value=");
			w.print(registry.get(type, key));
			w.println("i " + time);
		}
	}
	w.close();
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:36,代码来源:InfluxDbReporter.java

示例11: out

import java.io.PrintWriter; //导入方法依赖的package包/类
public void out(WebRequest r,Object metadata,OutputStream s)
{
	PrintWriter pw = new PrintWriter( s );
	int ind = r.path.indexOf("/");
	String concept = r.path.substring(ind+1);
	ind = concept.indexOf("/");
	String instance = concept.substring(ind+1);
	concept = concept.substring(0,ind);

	String instancepath = "Concepts/"+concept+"/instances/"+instance;
	
	String datapath = instancepath+"/data.txt";
	
	ObjectLanguageInstance o = ObjectLanguageInstance.loadObject(fs, datapath);
	if(o==null)
	{
		o = new ObjectLanguageInstance();
		o.uniqueID = concept+"/"+instance;
		o.name = instance;
		o.type = "map";
		
		o.physicalRepresentation = new ObjectPhysicalInstance();
		
		ObjectLanguageInstance.saveObject(o, fs, datapath);
	}
	
	pw.append("<h1>"+concept+"/"+instance+"</h1>");

	printPortal(o,pw);
	
	EditUtils.printObjects(o, pw, fs);
	
	pw.flush();
}
 
开发者ID:johndavidbustard,项目名称:RoughWorld,代码行数:35,代码来源:EditPortalInstance.java

示例12: write

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Write.
 *
 * @param out
 *            the out
 */
public void write(OutputStream out) {
	PrintWriter w = new PrintWriter(out);
	String instanceStr = instanceName.replace("\\", "\\\\").replace("\n", "\\n").replace("\"", "\\\"");
	String time = String.valueOf((registry.getMillis() / 1000) * 1000);
	for (String type : registry.getTypes()) {
		String typeStr = type.replace("\\", "\\\\").replace("\n", "\\n").replace("\"", "\\\"");
		for (String key : registry.getKeys(type)) {
			String keyStr = key.replace("\\", "\\\\").replace("\n", "\\n").replace("\"", "\\\"");
			String parts[] = typeStr.split("\\.", 3);
			w.print(parts[0]);
			w.print("{host=\"");
			w.print(instanceStr);
			w.print("\",instance=\"");
			if (parts.length > 1) {
				w.print(parts[1]);
			}
			w.print("\",type=\"");
			if (parts.length > 2) {
				w.append(parts[2]);
			}
			w.print("\",type_instance=\"");
			w.print(keyStr);
			w.print("\"} ");
			w.print(registry.get(type, key));
			w.println(" " + time);
		}
	}
	w.close();
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:36,代码来源:PrometheusReporter.java

示例13: appendResource

import java.io.PrintWriter; //导入方法依赖的package包/类
private static void appendResource(final PrintWriter pw,
                                   final HashedResource hashedResource,
                                   final Boolean isFiles2) {
    //http://stackoverflow.com/a/32663908
    pw.append("\t\t<key>").append(xmlEscapeString(Normalizer.normalize(hashedResource.getName(), Normalizer.Form.NFD))).append("</key>\n");
    Pattern p = Pattern.compile("\\.nib$|\\/Info[^/]*\\.plist$");
    Matcher m = p.matcher(hashedResource.getName());
    Boolean shouldAddDict = isFiles2 || m.find();
    if(shouldAddDict) {
        pw.append("\t\t<dict>\n\t\t\t<key>hash</key>\n\t");
    }
    pw.append("\t\t<data>\n");
    if(shouldAddDict) {
        pw.append("\t");
    }
    pw.append("\t\t").append(hashedResource.getHash()).append('\n');
    if(shouldAddDict) {
        pw.append("\t");
    }
    pw.append("\t\t</data>\n");

    if(isFiles2) {
        pw.append("\t\t\t<key>hash2</key>\n\t\t\t<data>\n\t\t\t");
        pw.append(hashedResource.get256Hash()).append("\n\t\t\t</data>\n");
    }
    p = Pattern.compile("\\.png$");
    m = p.matcher(hashedResource.getName());
    Boolean isPng = m.find();
    p = Pattern.compile("Icon.*\\.png$|LaunchImage.*\\.png$");
    m = p.matcher(hashedResource.getName());
    Boolean isExcludedPng = m.find();
    p = Pattern.compile("^Assets.car$|^archived-expanded-entitlements.xcent$|^embedded.mobileprovision$|^entitlements.plist$");
    m = p.matcher(hashedResource.getName());
    Boolean otherExclusions = m.find();
    if(shouldAddDict) {
        if ((!isFiles2 && !isPng) || (isFiles2 && !otherExclusions && !isExcludedPng)) {
            pw.append("\t\t\t<key>optional</key>\n\t\t\t<true/>\n");
        }
    }
    if(shouldAddDict) {
        pw.append("\t\t</dict>\n");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:44,代码来源:CodeResources.java

示例14: out

import java.io.PrintWriter; //导入方法依赖的package包/类
public void out(WebRequest r,Object metadata,OutputStream s)
	{
		PrintWriter pw = new PrintWriter( s );
		int ind = r.path.indexOf("/");
		String concept = r.path.substring(ind+1);
		ind = concept.indexOf("/");
		String instance = concept.substring(ind+1);
		concept = concept.substring(0,ind);

		String instancepath = "Concepts/"+concept+"/instances/"+instance;
		
		String datapath = instancepath+"/data.txt";
		
		ObjectLanguageInstance o = ObjectLanguageInstance.loadObject(fs, datapath);
		if(o==null)
		{
			o = new ObjectLanguageInstance();
			o.uniqueID = concept+"/"+instance;
			o.name = instance;
			o.type = "map";
			
			o.physicalRepresentation = new ObjectPhysicalInstance();
			
			ObjectLanguageInstance.saveObject(o, fs, datapath);
		}
		
//		if(o.physicalRepresentation.shape instanceof ModifiedCopyShape)
//		{
//			ModifiedCopyShape mcs = (ModifiedCopyShape)o.physicalRepresentation.shape;
//			mcs.buildParametersAndSides();
//			ObjectLanguageInstance.saveObject(o, fs, datapath);
//		}

		pw.append("<h1>"+concept+"/"+instance+"</h1>");

		printObject(o,pw);
		
		EditUtils.printObjects(o, pw, fs);
		
		pw.flush();
	}
 
开发者ID:johndavidbustard,项目名称:RoughWorld,代码行数:42,代码来源:EditObjectInstance.java

示例15: containsToSVG

import java.io.PrintWriter; //导入方法依赖的package包/类
public static void containsToSVG(PrintWriter pw,FileStoreInterface fs,ObjectLanguageInstance o,
		int[] origin,int inset,double scale,boolean printtext,
		GeneralMatrixDouble parentRelativeToWorldtran,
		int remainingDepth,
		boolean as3D)
{
	double[] dimensions = new double[3];
	double[] ctrans = o.physicalRepresentation.contains_metric_transform;
	for(int i=0;i<o.contains.length;i++)
	{
		String cid = o.contains[i];
		
		String cpath = ObjectLanguageInstance.uniqueIdToPath(cid);
		ObjectLanguageInstance c = ObjectLanguageInstance.loadObject(fs, cpath+"/data.txt");
		
		ParametricShape cshape = c.physicalRepresentation.shape;
		if(cshape!=null)
		{
			//compose the transforms
			int coff = i*12;
			GeneralMatrixDouble containedRelativeToParenttran = new GeneralMatrixDouble(4,4);
			containedRelativeToParenttran.setIdentity();
			for(int ti=0;ti<3;ti++)
				containedRelativeToParenttran.value[ti] = ctrans[coff+ti];
			for(int ti=0;ti<3;ti++)
				containedRelativeToParenttran.value[4+ti] = ctrans[coff+3+ti];
			for(int ti=0;ti<3;ti++)
				containedRelativeToParenttran.value[8+ti] = ctrans[coff+6+ti];
			containedRelativeToParenttran.set3DTransformPosition(ctrans[coff+9], ctrans[coff+10], ctrans[coff+11]);

			GeneralMatrixDouble containedRelativeToWorld = new GeneralMatrixDouble(4,4);
			
			//GeneralMatrixDouble.mult(parentRelativeToWorldtran, containedRelativeToParenttran, containedRelativeToWorld);
			
			GeneralMatrixDouble.mult(containedRelativeToParenttran, parentRelativeToWorldtran, containedRelativeToWorld);
			
			double x = containedRelativeToWorld.value[4*3+0];
			double y = containedRelativeToWorld.value[4*3+1];
			double z = containedRelativeToWorld.value[4*3+2];
			
			//addShape(cshape,origin[0]+x*scale,origin[1]+y*scale, scale,false, pw);
			addWireframeShape(cshape,containedRelativeToWorld, origin, scale, false, as3D, pw);
			
			if((remainingDepth>0)&&(c.contains.length>0))
			{
				containsToSVG(pw, fs, c, origin, inset, scale, false, containedRelativeToWorld, remainingDepth-1, as3D);
			}
			
			if(printtext)
			{
				cshape.getCuboidDimensions(dimensions);
				
				if(dimensions[0]<0.5)
				{
					pw.append("<g writing-mode=\"tb-rl\" font-size=\"14px\" font-family=\"Verdana\"\">");
				    //<text y="50px" text-anchor="middle">Direction</text>
					pw.append("<text fill=\"#000000\" x=\""+(7+inset+(x)*scale)+"\" y=\""+(inset+1+(y)*scale)+"\">"+c.name+"</text>");
					pw.append("</g>");
				}
				else
				{
					pw.append("<g writing-mode=\"lr-tb\" font-size=\"14px\" font-family=\"Verdana\"\">");
					pw.append("<text fill=\"#000000\" x=\""+(inset+x*scale)+"\" y=\""+(inset-1+(y+dimensions[1])*scale)+"\">"+c.name+"</text>");
					pw.append("</g>");
				}
			}	
		}
		
	}

}
 
开发者ID:johndavidbustard,项目名称:RoughWorld,代码行数:72,代码来源:StateToSVG.java


注:本文中的java.io.PrintWriter.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。