BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.util.Files Class Reference

Static Public Member Functions

static String getJsonFiles (final String path, final String pattern)
 
static String getJsonSortedFiles (final String path, final String pattern)
 
static String getJsonShuffledFiles (final String path, final String pattern)
 
static List< String > getFiles (final String path, final String pattern)
 
static File file (IConstructor constructor, String file)
 
static File file (String file)
 
static boolean exists (String path)
 
static String toExisting (String path)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 35 of file Files.java.

Member Function Documentation

◆ exists()

static boolean org.turro.elephant.impl.util.Files.exists ( String  path)
static

Definition at line 80 of file Files.java.

80  {
81  path = ElephantContext.getRealPath(path);
82  return path == null ? false : new File(path).exists();
83  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file() [1/2]

static File org.turro.elephant.impl.util.Files.file ( IConstructor  constructor,
String  file 
)
static

Definition at line 71 of file Files.java.

71  {
72  return file(file.replaceAll("\\*", constructor.getRenderingContext().getPath() + "/_internal/repository"));
73  }
static File file(IConstructor constructor, String file)
Definition: Files.java:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file() [2/2]

static File org.turro.elephant.impl.util.Files.file ( String  file)
static

Definition at line 75 of file Files.java.

75  {
76  file = ElephantContext.getRealPath(file);
77  return new File(file);
78  }
Here is the call graph for this function:

◆ getFiles()

static List<String> org.turro.elephant.impl.util.Files.getFiles ( final String  path,
final String  pattern 
)
static

Definition at line 53 of file Files.java.

53  {
54  ArrayList<String> files = new ArrayList<>();
55  File folder = new File(ElephantContext.getRealPath(path));
56  if(folder.exists()) {
57  for(File file : folder.listFiles(new FilenameFilter() {
58  @Override
59  public boolean accept(File dir, String name) {
60  return name.matches(Strings.convertToRegEx(pattern));
61  }
62  })) {
63  if(file.isFile()) {
64  files.add(ElephantContext.getRootWebPath() + path + "/" + file.getName());
65  }
66  }
67  }
68  return files;
69  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJsonFiles()

static String org.turro.elephant.impl.util.Files.getJsonFiles ( final String  path,
final String  pattern 
)
static

Definition at line 37 of file Files.java.

37  {
38  return new Gson().toJson(getFiles(path, pattern));
39  }
static List< String > getFiles(final String path, final String pattern)
Definition: Files.java:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJsonShuffledFiles()

static String org.turro.elephant.impl.util.Files.getJsonShuffledFiles ( final String  path,
final String  pattern 
)
static

Definition at line 47 of file Files.java.

47  {
48  List<String> files = getFiles(path, pattern);
49  Collections.shuffle(files);
50  return new Gson().toJson(files);
51  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJsonSortedFiles()

static String org.turro.elephant.impl.util.Files.getJsonSortedFiles ( final String  path,
final String  pattern 
)
static

Definition at line 41 of file Files.java.

41  {
42  List<String> files = getFiles(path, pattern);
43  Collections.sort(files);
44  return new Gson().toJson(files);
45  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toExisting()

static String org.turro.elephant.impl.util.Files.toExisting ( String  path)
static

Definition at line 85 of file Files.java.

85  {
86  while(!exists(path)) {
87  int p = path.lastIndexOf("/");
88  if(p > 0) {
89  path = path.substring(0, p);
90  } else {
91  break;
92  }
93  }
94  return path;
95  }
static boolean exists(String path)
Definition: Files.java:80
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: