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


Java PrintWriter.println方法代码示例

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


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

示例1: streamableRead

import java.io.PrintWriter; //导入方法依赖的package包/类
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:ValueBoxGen.java

示例2: printThread

import java.io.PrintWriter; //导入方法依赖的package包/类
private static void printThread(ThreadInfo ti, PrintWriter out) {
  out.print("\"" + ti.getThreadName() + "\"" + " Id="
      + ti.getThreadId() + " in " + ti.getThreadState());
  if (ti.getLockName() != null) {
    out.print(" on lock=" + ti.getLockName());
  }
  if (ti.isSuspended()) {
    out.print(" (suspended)");
  }
  if (ti.isInNative()) {
    out.print(" (running in native)");
  }
  out.println();
  if (ti.getLockOwnerName() != null) {
    out.println(INDENT + " owned by " + ti.getLockOwnerName() + " Id="
        + ti.getLockOwnerId());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TimedOutTestsListener.java

示例3: remove

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Remove the web application at the specified context path.
 *
 * @param writer Writer to render to
 * @param path Context path of the application to be removed
 */
protected void remove(PrintWriter writer, String path) {

    if (debug >= 1)
        log("remove: Removing web application at '" + path + "'");

    if ((path == null) || (!path.startsWith("/") && path.equals(""))) {
        writer.println(sm.getString("managerServlet.invalidPath", path));
        return;
    }
    String displayPath = path;
    if( path.equals("/") )
        path = "";

    try {
        Context context = deployer.findDeployedApp(path);
        if (context == null) {
            writer.println(sm.getString("managerServlet.noContext", displayPath));
            return;
        }
        // It isn't possible for the manager to remove itself
        if (context.getPath().equals(this.context.getPath())) {
            writer.println(sm.getString("managerServlet.noSelf"));
            return;
        }
        deployer.remove(path);
        writer.println(sm.getString("managerServlet.removed", displayPath));
    } catch (Throwable t) {
        log("ManagerServlet.remove[" + displayPath + "]", t);
        writer.println(sm.getString("managerServlet.exception",
                                    t.toString()));
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:40,代码来源:ManagerServlet.java

示例4: writeLines

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * write lines.
 * 
 * @param os output stream.
 * @param lines lines.
 * @throws IOException
 */
public static void writeLines(OutputStream os, String[] lines) throws IOException
{
	PrintWriter writer = new PrintWriter(new OutputStreamWriter(os));
	try
	{
		for( String line : lines )
			writer.println(line);
		writer.flush();
	}
	finally
	{
		writer.close();
	}
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:22,代码来源:IOUtils.java

示例5: processStack

import java.io.PrintWriter; //导入方法依赖的package包/类
private void processStack(DBGPCommand c) throws IOException, DBGPException
{
	if ((status != DBGPStatus.BREAK && status != DBGPStatus.STOPPING)
		|| breakpoint == null)
	{
		throw new DBGPException(DBGPErrorCode.NOT_AVAILABLE, c.toString());
	}

	OutputStream out = new ByteArrayOutputStream();
	PrintWriter pw = new PrintWriter(out);
	pw.println("Stopped [" + Thread.currentThread().getName() + "] " + breakpoint.location);
	breakContext.printStackTrace(pw, true);
	pw.close();
	cdataResponse(out.toString());
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:16,代码来源:DBGPReader.java

示例6: main

import java.io.PrintWriter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception  {

        if (!Platform.is64bit()) {
            System.out.println("Test needs a 4GB heap and can only be run as a 64bit process, skipping.");
            return;
        }

        PrintWriter pw = new PrintWriter("MANIFEST.MF");
        pw.println("Premain-Class: GetObjectSizeOverflowAgent");
        pw.close();

        ProcessBuilder pb = new ProcessBuilder();
        pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", "agent.jar", "GetObjectSizeOverflowAgent.class"});
        pb.start().waitFor();

        ProcessBuilder pt = ProcessTools.createJavaProcessBuilder(true, "-Xmx4000m", "-javaagent:agent.jar",  "GetObjectSizeOverflowAgent");
        OutputAnalyzer output = new OutputAnalyzer(pt.start());

        if (output.getStdout().contains("Could not reserve enough space") || output.getStderr().contains("java.lang.OutOfMemoryError")) {
            System.out.println("stdout: " + output.getStdout());
            System.out.println("stderr: " + output.getStderr());
            System.out.println("Test could not reserve or allocate enough space, skipping");
            return;
        }

        output.stdoutShouldContain("GetObjectSizeOverflow passed");
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:GetObjectSizeOverflow.java

示例7: dumpInner

import java.io.PrintWriter; //导入方法依赖的package包/类
void dumpInner(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
    writer.print(prefix); writer.print("Local Activity ");
    writer.print(Integer.toHexString(System.identityHashCode(this)));
    writer.println(" State:");
    String innerPrefix = prefix + "  ";
    writer.print(innerPrefix); writer.print("mResumed=");
    writer.print(mResumed); writer.print(" mStopped=");
    writer.print(mStopped); writer.print(" mFinished=");
    writer.println(mFinished);
    writer.print(innerPrefix); writer.print("mChangingConfigurations=");
    writer.println(mChangingConfigurations);
    writer.print(innerPrefix); writer.print("mCurrentConfig=");
    writer.println(mCurrentConfig);

    mFragments.dumpLoaders(innerPrefix, fd, writer, args);
    mFragments.getFragmentManager().dump(innerPrefix, fd, writer, args);
    if (mVoiceInteractor != null) {
        mVoiceInteractor.dump(innerPrefix, fd, writer, args);
    }

    if (getWindow() != null &&
            getWindow().peekDecorView() != null &&
            getWindow().peekDecorView().getViewRootImpl() != null) {
        getWindow().peekDecorView().getViewRootImpl().dump(prefix, fd, writer, args);
    }

    mHandler.getLooper().dump(new PrintWriterPrinter(writer), prefix);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:29,代码来源:a.java

示例8: commence

import java.io.PrintWriter; //导入方法依赖的package包/类
@Override
public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException {

	// Authentication failed, send error response.
	response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
	response.addHeader("WWW-Authenticate", "Basic realm=" + getRealmName() + "");

	PrintWriter writer = response.getWriter();
	writer.println("HTTP Status 401 : " + authException.getMessage());
}
 
开发者ID:edylle,项目名称:pathological-reports,代码行数:11,代码来源:CustomBasicAuthenticationEntryPoint.java

示例9: doGet

import java.io.PrintWriter; //导入方法依赖的package包/类
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();

    String uname = request.getParameter("uname");
       String upwd = request.getParameter("upwd");

    if(uname.equals("root") && upwd.equals("root")) {
        out.println("Login Success"); 
        }else {
      out.println("Login Failure");
    }
}
 
开发者ID:pratikdimble,项目名称:Servlet_Applet_Communication,代码行数:13,代码来源:LoginServlet.java

示例10: printSymbols

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Debug code used to print symbols
 *
 * @param block the block we are in
 * @param function the function we are in
 * @param ident identifier for block or function where applicable
 */
private void printSymbols(final Block block, final FunctionNode function, final String ident) {
    if (compiler.getScriptEnvironment()._print_symbols || function.getDebugFlag(FunctionNode.DEBUG_PRINT_SYMBOLS)) {
        final PrintWriter out = compiler.getScriptEnvironment().getErr();
        out.println("[BLOCK in '" + ident + "']");
        if (!block.printSymbols(out)) {
            out.println("<no symbols>");
        }
        out.println();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:CodeGenerator.java

示例11: end

import java.io.PrintWriter; //导入方法依赖的package包/类
protected void end(CometEvent event, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
    log("End for session: " + request.getSession(true).getId());
    synchronized(connections) {
        connections.remove(response);
    }
    
    PrintWriter writer = response.getWriter();
    writer.println("</body></html>");
    
    event.close();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:ChatServlet.java

示例12: printStackTrace

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * <p>Print stack trace to specified <code>PrintWriter</code>.</p>
 *
 * @param s Print stack trace to this <code>PrintWriter</code>.
 */
public void printStackTrace(PrintWriter s) {

    if (getCause() != null) {
        getCause().printStackTrace(s);
      s.println("--------------- linked to ------------------");
    }

    super.printStackTrace(s);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XPathException.java

示例13: print

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Prints the specified message, s, formatted to identify that the print
 * operation is against this server instance.
 *
 * @param msg The message to print
 */
protected void print(String msg) {

    PrintWriter writer = logWriter;

    if (writer != null) {
        writer.println("[" + serverId + "]: " + msg);
        writer.flush();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:Server.java

示例14: printRaw

import java.io.PrintWriter; //导入方法依赖的package包/类
/**
 * Prints for each class a raw output into the specified writer. This output includes all classes used by the class.
 *
 * @param writer
 *            Output stream.
 */
public void printRaw(PrintWriter writer) {
    final AtomicVertex[] graph = getClassGraph();
    for (int i = 0; i < graph.length; i++) {
        final AtomicVertex vertex = graph[i];
        writer.println(vertex.getAttributes());
        for (int j = 0, n = vertex.getNumberOfOutgoingArcs(); j < n; j++) {
            writer.println("    " + vertex.getHeadVertex(j).getAttributes());
        }
    }
    writer.close();
}
 
开发者ID:sake92,项目名称:hepek-classycle,代码行数:18,代码来源:Analyser.java

示例15: testMaxRunningAppsHierarchicalQueues

import java.io.PrintWriter; //导入方法依赖的package包/类
@Test
public void testMaxRunningAppsHierarchicalQueues() throws Exception {
  conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
  MockClock clock = new MockClock();
  scheduler.setClock(clock);

  PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
  out.println("<?xml version=\"1.0\"?>");
  out.println("<allocations>");
  out.println("<queue name=\"queue1\">");
  out.println("  <maxRunningApps>3</maxRunningApps>");
  out.println("  <queue name=\"sub1\"></queue>");
  out.println("  <queue name=\"sub2\"></queue>");
  out.println("  <queue name=\"sub3\">");
  out.println("    <maxRunningApps>1</maxRunningApps>");
  out.println("  </queue>");
  out.println("</queue>");
  out.println("</allocations>");
  out.close();

  scheduler.init(conf);
  scheduler.start();
  scheduler.reinitialize(conf, resourceManager.getRMContext());

  // exceeds no limits
  ApplicationAttemptId attId1 = createSchedulingRequest(1024, "queue1.sub1", "user1");
  verifyAppRunnable(attId1, true);
  verifyQueueNumRunnable("queue1.sub1", 1, 0);
  clock.tick(10);
  // exceeds no limits
  ApplicationAttemptId attId2 = createSchedulingRequest(1024, "queue1.sub3", "user1");
  verifyAppRunnable(attId2, true);
  verifyQueueNumRunnable("queue1.sub3", 1, 0);
  clock.tick(10);
  // exceeds no limits
  ApplicationAttemptId attId3 = createSchedulingRequest(1024, "queue1.sub2", "user1");
  verifyAppRunnable(attId3, true);
  verifyQueueNumRunnable("queue1.sub2", 1, 0);
  clock.tick(10);
  // exceeds queue1 limit
  ApplicationAttemptId attId4 = createSchedulingRequest(1024, "queue1.sub2", "user1");
  verifyAppRunnable(attId4, false);
  verifyQueueNumRunnable("queue1.sub2", 1, 1);
  clock.tick(10);
  // exceeds sub3 limit
  ApplicationAttemptId attId5 = createSchedulingRequest(1024, "queue1.sub3", "user1");
  verifyAppRunnable(attId5, false);
  verifyQueueNumRunnable("queue1.sub3", 1, 1);
  clock.tick(10);
  
  // Even though the app was removed from sub3, the app from sub2 gets to go
  // because it came in first
  AppAttemptRemovedSchedulerEvent appRemovedEvent1 =
      new AppAttemptRemovedSchedulerEvent(attId2, RMAppAttemptState.FINISHED, false);
  scheduler.handle(appRemovedEvent1);
  verifyAppRunnable(attId4, true);
  verifyQueueNumRunnable("queue1.sub2", 2, 0);
  verifyAppRunnable(attId5, false);
  verifyQueueNumRunnable("queue1.sub3", 0, 1);

  // Now test removal of a non-runnable app
  AppAttemptRemovedSchedulerEvent appRemovedEvent2 =
      new AppAttemptRemovedSchedulerEvent(attId5, RMAppAttemptState.KILLED, true);
  scheduler.handle(appRemovedEvent2);
  assertEquals(0, scheduler.maxRunningEnforcer.usersNonRunnableApps
      .get("user1").size());
  // verify app gone in queue accounting
  verifyQueueNumRunnable("queue1.sub3", 0, 0);
  // verify it doesn't become runnable when there would be space for it
  AppAttemptRemovedSchedulerEvent appRemovedEvent3 =
      new AppAttemptRemovedSchedulerEvent(attId4, RMAppAttemptState.FINISHED, true);
  scheduler.handle(appRemovedEvent3);
  verifyQueueNumRunnable("queue1.sub2", 1, 0);
  verifyQueueNumRunnable("queue1.sub3", 0, 0);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:76,代码来源:TestFairScheduler.java


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