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


Java OutputWriter类代码示例

本文整理汇总了Java中org.openide.windows.OutputWriter的典型用法代码示例。如果您正苦于以下问题:Java OutputWriter类的具体用法?Java OutputWriter怎么用?Java OutputWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: handle

import org.openide.windows.OutputWriter; //导入依赖的package包/类
public boolean handle(String line, OutputWriter stream) {
    Matcher m = STACK_TRACE.matcher(line);
    if (!m.matches()) {
        return false;
    }
    String pkg = m.group(1);
    String filename = m.group(2);
    String resource = pkg.replace('.', '/') + filename;
    int lineNumber = Integer.parseInt(m.group(3));
    try {
        stream.println(line, new Hyperlink(resource, lineNumber));
        return true;
    } catch (IOException x) {
        LOG.log(Level.INFO, null, x);
    }
    stream.println(line);
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:JavaHudsonLogger.java

示例2: NbBuildLogger

import org.openide.windows.OutputWriter; //导入依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
NbBuildLogger(File origScript, OutputWriter out, OutputWriter err, int verbosity, String displayName, Map<String,String> properties,
        Set<? extends String> concealedProperties, Runnable interestingOutputCallback, ProgressHandle handle, InputOutput io) {
    thisSession = LoggerTrampoline.ANT_SESSION_CREATOR.makeAntSession(this);
    this.origScript = origScript;
    this.out = out;
    this.err = err;
    this.io = io;
    this.verbosity = verbosity;
    this.properties = properties;
    this.concealedProperties = concealedProperties;
    this.displayName = displayName;
    this.interestingOutputCallback = interestingOutputCallback;
    this.handle = handle;
    LOG.log(Level.FINE, "---- Initializing build of {0} \"{1}\" at verbosity {2} ----", new Object[] {origScript, displayName, verbosity});
    enterProtectedMode(isCompileOnSave(properties));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbBuildLogger.java

示例3: println

import org.openide.windows.OutputWriter; //导入依赖的package包/类
public @Override void println(String message, boolean error, OutputListener listener) {
    verifyRunning();
    LOG.log(Level.FINEST, "println: error={0} listener={1} message={2}", new Object[] {error, listener, message});
    OutputWriter ow = error ? err : out;
    try {
        if (listener != null) {
            // Loggers wishing for more control can use getIO and do it themselves.
            boolean important = StandardLogger.isImportant(message);
            ow.println(message, listener, important);
            interestingOutputCallback.run();
        } else {
            ow.println(message);
        }
    } catch (IOException e) {
        LOG.log(Level.WARNING, null, e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbBuildLogger.java

示例4: doReload

import org.openide.windows.OutputWriter; //导入依赖的package包/类
protected void doReload(final RunConfig config, final String cname) {
    DebuggerTabMaintainer otm = getOutputTabMaintainer(config.getExecutionName());
    
    InputOutput io = otm.getInputOutput();
    io.select();
    OutputWriter ow = io.getOut();
    try {
        ow.reset();
    } catch (IOException ex) { }
    
    try {
        reload(config.getProject(), ow, cname);
    } finally {
        io.getOut().close();
        otm.markTab();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:DebuggerChecker.java

示例5: classToSourceURL

import org.openide.windows.OutputWriter; //导入依赖的package包/类
private String classToSourceURL (FileObject fo, OutputWriter logger) {
        ClassPath cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE);
        if (cp == null) {
            return null;
        }
        FileObject root = cp.findOwnerRoot (fo);
        String resourceName = cp.getResourceName (fo, '/', false);
        if (resourceName == null) {
            logger.println("Can not find classpath resource for "+fo+", skipping...");
            return null;
        }
        int i = resourceName.indexOf ('$');
        if (i > 0) {
            resourceName = resourceName.substring (0, i);
        }
        FileObject[] sRoots = SourceForBinaryQuery.findSourceRoots 
            (root.toURL ()).getRoots ();
        ClassPath sourcePath = ClassPathSupport.createClassPath (sRoots);
        FileObject rfo = sourcePath.findResource (resourceName + ".java");
        if (rfo == null) {
            return null;
        }
        return rfo.toURL ().toExternalForm ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DebuggerChecker.java

示例6: createSession

import org.openide.windows.OutputWriter; //导入依赖的package包/类
@Override
public HudsonLogSession createSession(final HudsonJob job) {
        return new HudsonLogSession() {
            final PlainLoggerLogic logic = new PlainLoggerLogic(job, job.getName());
            public boolean handle(String line, OutputWriter stream) {
                OutputListener link = logic.findHyperlink(line);
                if (link != null) {
                    try {
                        stream.println(line, link);
                        return true;
                    } catch (IOException x) {
                        LOG.log(Level.INFO, null, x);
                    }
                }
                stream.println(line);
                return true;
            }
        };
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PlainLogger.java

示例7: getOut

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
    * Stream to write to stuff being output by the process destined for the
    * terminal.
    * @return the writer.
    */
   @Override
   public OutputWriter getOut() {
// Ensure we  don't get two of them due to requests on
// different threads.
synchronized (this) {
    if (outputWriter == null) {
    ValueTask<Writer> task = new Task.GetOut(terminal);
    task.post();
    Writer writer = task.get();
    outputWriter = new TermOutputWriter(terminal, writer);
    }
}
terminal.setOutConnected(true);
       return outputWriter;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TerminalInputOutput.java

示例8: getErr

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
    * {@inheritDoc}
    * <p>
    * Output written to this Writer may appear in a different tab (not
    * supported) or different color (easily doable).
    * <p>
    * I'm hesitant to implement this because traditionally separation of
    * stdout and stderr (as done by {@link Process#getErrorStream}) is a dead
    * end. That is why {@link ProcessBuilder}'s redirectErrorStream property is
    * false by default. It is also why
    * {@link org.netbeans.lib.termsupport.TermExecutor#start} will
    * pre-combine stderr and stdout.
    */
   @Override
   public OutputWriter getErr() {
// Ensure we  don't get two of them due to requests on
// different threads.
synchronized (this) {
    // workaround for #182063: -  UnsupportedOperationException
    if (errWriter == null) {
    ValueTask<Writer> task = new Task.GetOut(terminal);
    task.post();
    Writer writer = task.get();
    errWriter = new TermErrWriter(terminal, writer);
    }
}
terminal.setErrConnected(true);
return errWriter;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:TerminalInputOutput.java

示例9: exercise

import org.openide.windows.OutputWriter; //导入依赖的package包/类
private void exercise(InputOutput xio, OutputWriter ow, final int nlines) {

    IOPosition.Position positions[] = new IOPosition.Position[nlines];

    for (int lx = 0; lx < nlines; lx++) {
        ow.println("Line " + lx + "\r");
        try {
        IOColorLines.println(xio, "Colored line\r", Color.blue);
        positions[lx] = IOPosition.currentPosition(io);
        } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
        }
    }

    sleep(1);
    xio.select();
    for (int lx = 0; lx < nlines; lx+=2) {
        positions[lx].scrollTo();
        sleep(1);
    }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:T5_MTStress_Test.java

示例10: clearOutput

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
 * Select and Clear OutputLogger's tab
 *
 * @param list to print out
 * 
 */
public void clearOutput(){
    rp.post(new Runnable() {
        public void run() {             
            OutputWriter out = getLog().getOut();
            if (writable) {
                try {
                    out.reset();
                } catch (IOException ex) {
                    // Ignore Exception
                }
                out.flush();
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:OutputLogger.java

示例11: testHardWeakStream

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
    * Hard close, weak close, then stream close
    */
   public void testHardWeakStream() {
System.out.printf("testHardWeakStream()\r");

OutputWriter ow = io.getOut();
ow.println("Hello to Out\r");

io.closeInputOutput();
if (IOVisibility.isSupported(io))
    IOVisibility.setVisible(io, false);
ow.close();

// Additional operations should be no-ops
ow.println("Should go to bitbucket\r");
io.select();
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:T3_HardClose_Test.java

示例12: testWeakHardStream

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
    * Weak close, hard close,then stream close
    */
   public void testWeakHardStream() {
System.out.printf("testWeakHardStream()\r");

OutputWriter ow = io.getOut();
ow.println("Hello to Out\r");

if (IOVisibility.isSupported(io))
    IOVisibility.setVisible(io, false);
io.closeInputOutput();
ow.close();

// Additional operations should be no-ops
ow.println("Should go to bitbucket\r");
io.select();
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:T3_HardClose_Test.java

示例13: testWeakStreamHard

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
    * Weak close, stream close, then hard close
    */
   public void testWeakStreamHard() {
System.out.printf("testWeakStreamHard()\r");

OutputWriter ow = io.getOut();
ow.println("Hello to Out\r");

if (IOVisibility.isSupported(io))
    IOVisibility.setVisible(io, false);
ow.close();
io.closeInputOutput();

// redundant hard closes should not cause problems
io.closeInputOutput();

// Additional operations should be no-ops
ow.println("Should go to bitbucket\r");
io.select();
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:T3_HardClose_Test.java

示例14: output

import org.openide.windows.OutputWriter; //导入依赖的package包/类
/**
 * Print contents of list to OutputLogger's tab
 *
 * @param list to print out
 * 
 */
 public void output(final List<String> list){
    if( list.isEmpty()) return;

    rp.post(new Runnable() {
        public void run() { 
            OutputWriter out = getLog().getOut();
            if (writable) {
                for (String s : list) {
                    out.println(s);
                }
                out.flush();
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:OutputLogger.java

示例15: out

import org.openide.windows.OutputWriter; //导入依赖的package包/类
private void out(final boolean toError, final CharSequence... cs) {
    final Action<Void> action = new Action<Void>() {
        
        @Override
        public Void run() {
            if (descriptor.inputOutput != null) {
                OutputWriter w = toError
                        ? descriptor.inputOutput.getErr()
                        : descriptor.inputOutput.getOut();
                if (w != null) {
                    for (CharSequence c : cs) {
                        w.append(c);
                    }
                }
            }
            return null;
        }
    };
    if (isUnitTestMode()) {
        action.run();
    } else {
        Mutex.EVENT.writeAccess(action);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NativeExecutionService.java


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