Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
133eaad5
Commit
133eaad5
authored
May 5, 2014
by
hansen
Browse files
Options
Downloads
Patches
Plain Diff
added missing class
parent
7b82ee8f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tla2b/util/FileUtils.java
+46
-0
46 additions, 0 deletions
src/main/java/de/tla2b/util/FileUtils.java
with
46 additions
and
0 deletions
src/main/java/de/tla2b/util/FileUtils.java
0 → 100644
+
46
−
0
View file @
133eaad5
package
de.tla2b.util
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.IOException
;
public
class
FileUtils
{
public
static
String
removeExtention
(
String
filePath
)
{
File
f
=
new
File
(
filePath
);
// if it's a directory, don't remove the extention
if
(
f
.
isDirectory
())
return
filePath
;
String
name
=
f
.
getName
();
// Now we know it's a file - don't need to do any special hidden
// checking or contains() checking because of:
final
int
lastPeriodPos
=
name
.
lastIndexOf
(
'.'
);
if
(
lastPeriodPos
<=
0
)
{
// No period after first character - return name as it was passed in
return
filePath
;
}
else
{
// Remove the last period and everything after it
File
renamed
=
new
File
(
f
.
getParent
(),
name
.
substring
(
0
,
lastPeriodPos
));
return
renamed
.
getPath
();
}
}
public
static
String
fileToString
(
String
fileName
)
throws
IOException
{
StringBuilder
res
=
new
StringBuilder
();
BufferedReader
in
=
new
BufferedReader
(
new
FileReader
(
fileName
));
String
str
;
while
((
str
=
in
.
readLine
())
!=
null
)
{
res
.
append
(
str
+
"\n"
);
}
in
.
close
();
return
res
.
toString
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment