📄 fileutil.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
package com.golden.gamedev.util;
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
// Referenced classes of package com.golden.gamedev.util:
// Utility
public class FileUtil
{
public static boolean fileWrite(String as[], File file)
{
BufferedWriter bufferedwriter = new BufferedWriter(new FileWriter(file));
PrintWriter printwriter = new PrintWriter(bufferedwriter);
for(int i = 0; i < as.length; i++)
printwriter.println(as[i]);
printwriter.close();
return true;
printStackTrace();
return false;
}
public static String[] fileRead(File file)
{
ArrayList arraylist;
FileReader filereader = new FileReader(file);
BufferedReader bufferedreader = new BufferedReader(filereader);
arraylist = new ArrayList(50);
String s;
while((s = bufferedreader.readLine()) != null)
arraylist.add(s);
bufferedreader.close();
return Utility.compactStrings((String[])arraylist.toArray(new String[0]));
printStackTrace();
return null;
}
public static String[] fileRead(InputStream inputstream)
{
ArrayList arraylist;
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
arraylist = new ArrayList(50);
String s;
while((s = bufferedreader.readLine()) != null)
arraylist.add(s);
bufferedreader.close();
return Utility.compactStrings((String[])arraylist.toArray(new String[0]));
printStackTrace();
return null;
}
public static String[] fileRead(URL url)
{
return fileRead(url.openStream());
printStackTrace();
return null;
}
public static File setExtension(File file, String s)
{
String s1;
int i;
if((i = (s1 = file.getAbsolutePath()).lastIndexOf(46)) < 0)
return new File(s1 + "." + s);
else
return new File(s1.substring(0, i) + "." + s);
}
public static String getExtension(File file)
{
return getExtension(file.getName());
}
public static String getExtension(String s)
{
int i;
String s1 = (i = n(s)) > 0 ? s.substring(i + 1) : s;
String s2 = "";
int j;
if((j = s1.lastIndexOf(46)) > 0 && j < s1.length() - 1)
s2 = s1.substring(j + 1);
return s2;
}
public static String getName(File file)
{
return getName(file.getName());
}
public static String getName(String s)
{
int i;
String s1;
String s2 = s1 = (i = n(s)) > 0 ? s.substring(i + 1) : s;
int j;
if((j = s1.lastIndexOf(46)) > 0 && j < s1.length())
s2 = s1.substring(0, j);
return s2;
}
public static String getPath(File file)
{
return getPath(file.getCanonicalPath());
printStackTrace();
return null;
}
public static String getPath(String s)
{
String s1 = "";
int i;
if((i = n(s)) > 0)
s1 = s.substring(0, i + 1);
return s1;
}
public static String getPathName(File file)
{
return getPathName(file.getCanonicalPath());
printStackTrace();
return null;
}
public static String getPathName(String s)
{
String s1 = "";
int i;
if((i = n(s)) > 0)
s1 = s.substring(0, i + 1);
else
i = 0;
String s2;
String s3 = s2 = i > 0 ? s.substring(i + 1) : s;
int j;
if((j = s2.lastIndexOf(46)) > 0 && j < s2.length())
s3 = s2.substring(0, j);
return s1 + s3;
}
private static int n(String s)
{
int i;
if((i = s.lastIndexOf(47)) < 0)
i = s.lastIndexOf(File.separatorChar);
return i;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -