Child: [r15] (diff)

Download this file

properties.java    142 lines (125 with data), 4.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package config;
import java.io.File;
import script.FileExtension;
import spdxlib.ContentType;
import spdxlib.FileCategory;
/*
* SPDXVersion: SPDX-1.1
* Creator: Person: Nuno Brito
* Created: 2013-11-16T14:49:00Z
* LicenseName: CC-BY-3.0
* FileName: properties.java
* FileCategory: SOURCE
* FileCopyrightText: <text> Copyright Š 2013, Nuno Brito </text>
* FileComment: <text> This class provides details about files that have
* the extension of type properties. Extensions tend to represent a specific type
* of file structure from where we can extract information. In some cases, the
* same type of file is used for representing different types of data from
* different types of applications. We make no specific arrangement to handle
* these cases, albeit this class should be able of distinguishing each one of
* them and then provide a suited answer. For example, NFO files are both used
* as text files with information or used as binay files by a different tool.
*
* The extension handler should be able of distinguishing these cases.
* </text>
*/
/**
*
* @author Nuno Brito
*/
public class properties extends FileExtension{
/**
* How can we confirm that this file extension is appliable to this file?
* This method analyses the binary contents of a file to get the answer.
* @param binaryFile the pointer to a file on disk
* @return True if file matches the data structure reported by the extension
*/
@Override
public Boolean isApplicable(File binaryFile) {
return true;
}
/**
* How can we confirm that this file extension is appliable to this file?
* This method analyses the text of a file to get the answer. You can either
* specify a file or the text. The advantage of using this method is that
* you will not need to read the text from the file for each extension test.
* This brings significant performance improvements when analyzing
* thousands of files.
* @param textFile The content of a text file
* @return True if file matches the data structure reported by the extension
*/
@Override
public Boolean isApplicable(String textFile) {
return true;
}
/**
* A short text explaining what this file type is all about
*/
@Override
public String getDescription() {
return null; // file type description
}
/**
* Are we collecting this description information from somewhere else?
*/
@Override
public String getDescriptionURL(){
return null; // where the original page can be reached
}
/**
* Who is the owner for description that was provided?
* What are the applicable license terms?
*/
@Override
public String getDescriptionCredits(){
return null; //author of description
}
/**
* Typically, this is the three letter identifier of the file extension.
* We use everything in lower case to speed the processing performance.
* @return the unique identifier for this file type
*/
@Override
public String getIdentifierShort() {
return "properties";
}
/**
* Who has the copyright over this file? Sometimes this is information that
* can be extracted from the meta-data inside the data contents. When
* available, this information is available using this method.
* @return A string with with copyright text extracted from the file
*/
@Override
public String getCopyright() {
return null;
}
/**
* What is the version for this file? Sometimes this is information that
* can be extracted from the meta-data inside the data contents. When
* available, this information is available using this method.
* @return A string with with version text extracted from the file
*/
@Override
public String getVersion() {
return null;
}
/**
* Returns information is this file has a binary or text based structure.
* This is later used by the "isApplicable()" methods to speed up the
* processing of each file
* @return the type of content expected inside the file
*/
@Override
public ContentType getContentType() {
return ContentType.TEXT;
}
/**
* We can typically group data structures inside files to a few categories.
* Albeit not perfect, it does help to sort out files into groups.
* @return the category generally associated with this file type
*/
@Override
public FileCategory getCategory() {
return FileCategory.CONFIG;
}
}