org.apache.wicket.util.file.File.write()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(165)

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

File.write介绍

[英]Writes the given input stream to this file
[中]将给定的输入流写入此文件

代码示例

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Writes the given file to this one
 * 
 * @param file
 *            The file to copy
 * @throws IOException
 */
public final void write(final File file) throws IOException
{
  final InputStream in = new BufferedInputStream(new FileInputStream(file));
  try
  {
    write(in);
  }
  finally
  {
    in.close();
  }
}

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * Writes the given file to this one
 * 
 * @param file
 *            The file to copy
 * @return number of bytes written
 * @throws IOException
 */
public int write(final File file) throws IOException
{
  final InputStream in = new BufferedInputStream(new FileInputStream(file));
  try
  {
    return write(in);
  }
  finally
  {
    in.close();
  }
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Writes the given file to this one
 * 
 * @param file
 *            The file to copy
 * @throws IOException
 */
public final void write(final File file) throws IOException
{
  final InputStream in = new BufferedInputStream(new FileInputStream(file));
  try
  {
    write(in);
  }
  finally
  {
    in.close();
  }
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

public boolean addLicenseHeader(File file)
{
  boolean added = false;
  try
  {
    String content = new org.apache.wicket.util.file.File(file).readString();
    String xml = "";
    StringBuffer newContent = new StringBuffer();
    Matcher mat = xmlHeader.matcher(content);
    if (mat.matches())
    {
      xml = mat.group(1);
      content = mat.group(2);
    }
    if (Strings.isEmpty(xml) == false)
    {
      newContent.append(xml).append(LINE_ENDING);
    }
    newContent.append(getLicenseHeader()).append(LINE_ENDING);
    newContent.append(content);
    new org.apache.wicket.util.file.File(file).write(newContent.toString());
    added = true;
  }
  catch (Exception e)
  {
    Assert.fail(e.getMessage());
  }
  return added;
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

@Override
public boolean addLicenseHeader(File file)
{
  boolean added = false;
  try
  {
    String content = new org.apache.wicket.util.file.File(file).readString();
    String xml = "";
    StringBuffer newContent = new StringBuffer();
    Matcher mat = xmlHeader.matcher(content);
    if (mat.matches())
    {
      xml = mat.group(1);
      content = mat.group(2);
    }
    if (Strings.isEmpty(xml) == false)
    {
      newContent.append(xml).append(LINE_ENDING);
    }
    newContent.append(getLicenseHeader()).append(LINE_ENDING);
    newContent.append(content);
    new org.apache.wicket.util.file.File(file).write(newContent.toString());
    added = true;
  }
  catch (Exception e)
  {
    Assert.fail(e.getMessage());
  }
  return added;
}

代码示例来源:origin: org.apache.wicket/wicket-util

newContent.append(content);
new org.apache.wicket.util.file.File(file).write(newContent.toString());
added = true;

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

public boolean addLicenseHeader(File file)
{
  boolean added = false;
  try
  {
    String fileContent = new org.apache.wicket.util.file.File(file).readString();
    Matcher mat = javaHeaderPattern.matcher(fileContent);
    if (mat.matches())
    {
      String header = mat.group(1);
      if (header.equals(getLicenseHeader()) == false)
      {
        String newContent = Strings.replaceAll(fileContent, header, "").toString();
        newContent = getLicenseHeader().trim() + LINE_ENDING + newContent;
        new org.apache.wicket.util.file.File(file).write(newContent);
        added = true;
      }
    }
    else
    {
      Assert.fail();
    }
  }
  catch (Exception e)
  {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
  return added;
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

new org.apache.wicket.util.file.File(file).write(newContent);

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
   * Add the license header to the start of the file without caring about existing license
   * headers.
   * 
   * @param file
   *            The file to add the license header to.
   */
  protected void prependLicenseHeader(File file)
  {
    try
    {
      String content = new org.apache.wicket.util.file.File(file).readString();
      content = getLicenseHeader() + LINE_ENDING + content;
      new org.apache.wicket.util.file.File(file).write(content);
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
   * Add the license header to the start of the file without caring about existing license
   * headers.
   * 
   * @param file
   *            The file to add the license header to.
   */
  protected void prependLicenseHeader(File file)
  {
    try
    {
      String content = new org.apache.wicket.util.file.File(file).readString();
      content = getLicenseHeader() + LINE_ENDING + content;
      new org.apache.wicket.util.file.File(file).write(content);
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }
  }
}

代码示例来源:origin: org.apache.wicket/wicket-util

new org.apache.wicket.util.file.File(file).write(newContent);

代码示例来源:origin: org.apache.wicket/wicket-util

/**
   * Add the license header to the start of the file without caring about existing license
   * headers.
   * 
   * @param file
   *            The file to add the license header to.
   */
  protected void prependLicenseHeader(final File file)
  {
    try
    {
      String content = new org.apache.wicket.util.file.File(file).readString();
      content = getLicenseHeader() + LINE_ENDING + content;
      new org.apache.wicket.util.file.File(file).write(content);
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }
  }
}

相关文章