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


Java OutPort类代码示例

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


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

示例1: serve

import gnu.mapping.OutPort; //导入依赖的package包/类
/** Run a Kawa repl as a telnet server.
 *  @param client A client that has connected to us,
 *  and that wants to use the telnet protocol to talk to a
 *  Scheme read-eval-print-loop.
 */
public static Thread serve (Language language, java.net.Socket client)
  throws java.io.IOException {
  Telnet conn = new Telnet(client, true);
  java.io.OutputStream sout = conn.getOutputStream();
  java.io.InputStream sin = conn.getInputStream();
  OutPort out = new OutPort(sout, FilePath.valueOf("/dev/stdout"));
  TtyInPort in = new TtyInPort(sin, FilePath.valueOf("/dev/stdin"), out);
  // The following was commented out in the original code - markf
  /*
  conn.request(Telnet.DO, Telnet.EOF);
  conn.request(Telnet.DO, Telnet.NAWS);
  conn.request(Telnet.DO, Telnet.TTYPE);
  conn.request(Telnet.DO, Telnet.LINEMODE);
  */

  Thread thread =
      new BiggerFuture(new TelnetRepl(language, client),
                       in, out, out, "Telnet Repl Thread", REPL_STACK_SIZE);
  thread.start();
  return thread;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:27,代码来源:TelnetRepl.java

示例2: format

import gnu.mapping.OutPort; //导入依赖的package包/类
public int format(Object[] args, int start, Writer dst, FieldPosition fpos)  
   throws java.io.IOException 
 {
   int count = getParam(this.count, 1, args, start);
   if (this.count == LispFormat.PARAM_FROM_LIST)  start++;
   if (count > 0)
     {
if (dst instanceof OutPort)
  {
    ((OutPort) dst).freshLine();
    count--;
  }
while (--count >= 0)
  dst.write('\n');
     }
   return start; 
 }
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:18,代码来源:LispFormat.java

示例3: format

import gnu.mapping.OutPort; //导入依赖的package包/类
public int format(Object[] args, int start, Appendable dst, FieldPosition fpos)  
   throws java.io.IOException 
 {
   int count = getParam(this.count, 1, args, start);
   if (this.count == LispFormat.PARAM_FROM_LIST)  start++;
   if (count > 0)
     {
if (dst instanceof OutPort)
  {
    ((OutPort) dst).freshLine();
    count--;
  }
while (--count >= 0)
  dst.append('\n');
     }
   return start; 
 }
 
开发者ID:alain91,项目名称:kawa,代码行数:18,代码来源:LispFormat.java

示例4: run

import gnu.mapping.OutPort; //导入依赖的package包/类
public synchronized void run()
{
  for (WriterRef ref = first;  ref != null; )
    {
      WriterRef next = ref.next;
      Object port = ref.get();
      if (port != null)
        {
          try
            {
              ((OutPort) port).finalize();
            }
          catch (Throwable ex)
            {
              // ignore
            }
        }
      ref = next;
    }
  first = null;
}
 
开发者ID:alain91,项目名称:kawa,代码行数:22,代码来源:WriterManager.java

示例5: printNewline

import gnu.mapping.OutPort; //导入依赖的package包/类
public static void printNewline(int kind, Writer dst)
  throws java.io.IOException
{
  if (dst instanceof OutPort && kind != PrettyWriter.NEWLINE_LITERAL)
    ((OutPort) dst).writeBreak(kind);
  else if (dst instanceof java.io.PrintWriter)
    // May make a difference if autoflush.  // FIXME flush if OutPort?
    ((java.io.PrintWriter) dst).println();
  else
    dst.write(line_separator);
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:12,代码来源:LispFormat.java

示例6: print

import gnu.mapping.OutPort; //导入依赖的package包/类
public void print (OutPort out)
{
  out.writeSpaceLinear();
  out.startLogicalBlock("(Catch", ")", 2);
  out.writeSpaceFill();
  decls.printInfo(out);
  out.writeSpaceLinear();
  body.print(out);
  out.endLogicalBlock(")");
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:11,代码来源:CatchClause.java

示例7: printNewline

import gnu.mapping.OutPort; //导入依赖的package包/类
public static void printNewline(int kind, Appendable dst)
  throws java.io.IOException
{
  if (dst instanceof OutPort && kind != PrettyWriter.NEWLINE_LITERAL)
    ((OutPort) dst).writeBreak(kind);
  else if (dst instanceof java.io.PrintWriter)
    // May make a difference if autoflush.  // FIXME flush if OutPort?
    ((java.io.PrintWriter) dst).println();
  else
    dst.append(line_separator);
}
 
开发者ID:alain91,项目名称:kawa,代码行数:12,代码来源:LispFormat.java

示例8: register

import gnu.mapping.OutPort; //导入依赖的package包/类
/** Register a Writer.
 * @return an object that can be passed to {@link #unregister}.
 */
public synchronized WriterRef register (OutPort port)
{
  WriterRef ref = new WriterRef(port);
  WriterRef first = this.first; // Copy field to local variable.
  if (first != null)
    {
      ref.next = first;
      first.prev = ref;
    }
  this.first = ref;
  return ref;
}
 
开发者ID:alain91,项目名称:kawa,代码行数:16,代码来源:WriterManager.java

示例9: BiggerFuture

import gnu.mapping.OutPort; //导入依赖的package包/类
public BiggerFuture(Procedure action,
                    InPort in, OutPort out, OutPort err, String threadName, long stackSize) {
  super(new ThreadGroup("biggerthreads"),
        new RunnableClosure (action, in, out, err),
        threadName, stackSize);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:7,代码来源:BiggerFuture.java

示例10: XMLPrinter

import gnu.mapping.OutPort; //导入依赖的package包/类
public XMLPrinter (OutPort out, boolean autoFlush)
{
  super(out, autoFlush);
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:5,代码来源:XMLPrinter.java

示例11: make

import gnu.mapping.OutPort; //导入依赖的package包/类
public static XMLPrinter make(OutPort out, Object style)
{
  XMLPrinter xout = new XMLPrinter(out, true);
  xout.setStyle(style);
  return xout;
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:7,代码来源:XMLPrinter.java


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