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

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

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

File.readString介绍

暂无

代码示例

代码示例来源: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

String content = new org.apache.wicket.util.file.File(file).readString();
String xml = "";
StringBuilder newContent = new StringBuilder();

代码示例来源: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

String fileContent = new org.apache.wicket.util.file.File(file).readString();

代码示例来源: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

String fileContent = new org.apache.wicket.util.file.File(file).readString();

代码示例来源: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());
    }
  }
}

相关文章