org.eclipse.jetty.util.IO.close()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.eclipse.jetty.util.IO.close()方法的一些代码示例,展示了IO.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.close()方法的具体详情如下:
包路径:org.eclipse.jetty.util.IO
类名称:IO
方法名:close

IO.close介绍

[英]Closes an arbitrary closable, and logs exceptions at ignore level
[中]关闭任意可关闭文件,并在忽略级别记录异常

代码示例

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * closes a reader, and logs exceptions
 *
 * @param reader the reader to close
 */
public static void close(Reader reader)
{
  close((Closeable)reader);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * closes an output stream, and logs exceptions
 *
 * @param os the output stream to close
 */
public static void close(OutputStream os)
{
  close((Closeable)os);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * closes a writer, and logs exceptions
 *
 * @param writer the writer to close
 */
public static void close(Writer writer)
{
  close((Closeable)writer);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * closes an input stream, and logs exceptions
 *
 * @param is the input stream to close
 */
public static void close(InputStream is)
{
  close((Closeable)is);
}

代码示例来源:origin: jenkinsci/winstone

/**
 * closes an input stream, and logs exceptions
 *
 * @param is the input stream to close
 */
public static void close(InputStream is)
{
  close((Closeable)is);
}

代码示例来源:origin: jenkinsci/winstone

/**
 * closes an output stream, and logs exceptions
 *
 * @param os the output stream to close
 */
public static void close(OutputStream os)
{
  close((Closeable)os);
}

代码示例来源:origin: jenkinsci/winstone

/**
 * closes a writer, and logs exceptions
 *
 * @param writer the writer to close
 */
public static void close(Writer writer)
{
  close((Closeable)writer);
}

代码示例来源:origin: jenkinsci/winstone

/**
 * closes a reader, and logs exceptions
 *
 * @param reader the reader to close
 */
public static void close(Reader reader)
{
  close((Closeable)reader);
}

代码示例来源:origin: org.mortbay.jetty/jetty-maven-plugin

public void run()
  {
    String line;
    try
    {
      while ((line = reader.readLine()) != (null))
      {
        System.out.println("[" + mode + "] " + line);
      }
    }
    catch (IOException ignore)
    {
      /* ignore */
    }
    finally
    {
      IO.close(reader);
    }
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

/**
 * @param file
 */
public DirectNIOBuffer(File file) throws IOException
{
  super(READONLY,NON_VOLATILE);
  FileInputStream fis = null;
  FileChannel fc = null;
  try
  {
    fis = new FileInputStream(file);
    fc = fis.getChannel();
    _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
    setGetIndex(0);
    setPutIndex((int)file.length());
    _access=IMMUTABLE;
  }
  finally
  {
    if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);}
    IO.close(fis);
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * @param file
 */
public DirectNIOBuffer(File file) throws IOException
{
  super(READONLY,NON_VOLATILE);
  FileInputStream fis = null;
  FileChannel fc = null;
  try
  {
    fis = new FileInputStream(file);
    fc = fis.getChannel();
    _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
    setGetIndex(0);
    setPutIndex((int)file.length());
    _access=IMMUTABLE;
  }
  finally
  {
    if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);}
    IO.close(fis);
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * @param file
 */
public DirectNIOBuffer(File file) throws IOException
{
  super(READONLY,NON_VOLATILE);
  FileInputStream fis = null;
  FileChannel fc = null;
  try
  {
    fis = new FileInputStream(file);
    fc = fis.getChannel();
    _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
    setGetIndex(0);
    setPutIndex((int)file.length());
    _access=IMMUTABLE;
  }
  finally
  {
    if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);}
    IO.close(fis);
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

/**
 * @param file
 */
public DirectNIOBuffer(File file) throws IOException
{
  super(READONLY,NON_VOLATILE);
  FileInputStream fis = null;
  FileChannel fc = null;
  try
  {
    fis = new FileInputStream(file);
    fc = fis.getChannel();
    _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
    setGetIndex(0);
    setPutIndex((int)file.length());
    _access=IMMUTABLE;
  }
  finally
  {
    if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);}
    IO.close(fis);
  }
}

代码示例来源:origin: org.eclipse.jetty.websocket/websocket-common

@Override
public void incomingFrame(Frame frame)
{
  saveFrame(frame,false);
  try
  {
    nextIncomingFrame(frame);
  }
  catch (Throwable t)
  {
    IO.close(incomingChannel);
    incomingChannel = null;
    throw t;
  }
}

代码示例来源:origin: org.eclipse.jetty.websocket/websocket-common

@Override
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
{
  saveFrame(frame,true);
  try
  {
    nextOutgoingFrame(frame,callback,batchMode);
  }
  catch (Throwable t)
  {
    IO.close(outgoingChannel);
    outgoingChannel = null;
    throw t;
  }
}

代码示例来源:origin: jenkinsci/winstone

@Override
  public void onCompleteFailure(Throwable x)
  {
    abort(x);
    _channel.getByteBufferPool().release(_buffer);
    IO.close(_in);
    super.onCompleteFailure(x);
  }
}

代码示例来源:origin: jenkinsci/winstone

@Override
  public void onCompleteFailure(Throwable x)
  {
    abort(x);
    _channel.getByteBufferPool().release(_buffer);
    IO.close(_in);
    super.onCompleteFailure(x);
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

IO.close(out);
IO.close(writer);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

IO.close(out);
IO.close(writer);

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

public synchronized void deIdle()
{
  if (isIdled())
  {
    // Access now to prevent race with idling period
    access(System.currentTimeMillis());
    if (LOG.isDebugEnabled())
      LOG.debug("De-idling " + super.getId());
    FileInputStream fis = null;
    try
    {
      File file = new File(_hashSessionManager._storeDir, super.getId());
      if (!file.exists() || !file.canRead())
        throw new FileNotFoundException(file.getName());
      fis = new FileInputStream(file);
      _idled = false;
      _hashSessionManager.restoreSession(fis, this);
      didActivate();
      // If we are doing period saves, then there is no point deleting at this point
      if (_hashSessionManager._savePeriodMs == 0)
        file.delete();
    }
    catch (Exception e)
    {
      LOG.warn("Problem de-idling session " + super.getId(), e);
      IO.close(fis);
      invalidate();
    }
  }
}

相关文章