Package javaforce
Class JF
java.lang.Object
javaforce.JF
- Direct Known Subclasses:
ParseArgs
A collection of useful static methods.
- Author:
- Peter Quiring
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char[]Copy of Integer.digitsstatic StringFilter regex for any letter.static StringFilter regex for any letter or number.static StringFilter regex for any hex number.static StringFilter regex for any number.static final booleanstatic Stringstatic final String[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatstatic intstatic intstatic StringRemoves user info from any URL.static SocketconnectSSL(String host, int port) static SocketconnectSSL(String host, int port, KeyMgmt keys) static SocketconnectSSL(Socket socket) Upgrades existing socket to SSL (client side).static SocketconnectSSL(Socket socket, boolean server) Upgrades existing socket to SSL.static booleancopyAll(InputStream is, OutputStream os) static booleancopyAll(InputStream is, OutputStream os, long length) static booleanstatic booleancopyAllAppend(String src, String dst) static booleanstatic boolean[]copyOfExcluding(boolean[] array, int idx) static byte[]copyOfExcluding(byte[] array, int idx) static char[]copyOfExcluding(char[] array, int idx) static double[]copyOfExcluding(double[] array, int idx) static float[]copyOfExcluding(float[] array, int idx) static int[]copyOfExcluding(int[] array, int idx) static short[]copyOfExcluding(short[] array, int idx) static <T> T[]copyOfExcluding(T[] array, int idx) static boolean[]copyOfInsert(boolean[] array, int idx, boolean insert) static byte[]copyOfInsert(byte[] array, int idx, byte insert) static double[]copyOfInsert(double[] array, int idx, double insert) static float[]copyOfInsert(float[] array, int idx, float insert) static int[]copyOfInsert(int[] array, int idx, int insert) static long[]copyOfInsert(long[] array, int idx, long insert) static short[]copyOfInsert(short[] array, int idx, short insert) static <T> T[]copyOfInsert(T[] array, int idx, T insert) static ServerSocketcreateServerSocketSSL(int port) static ServerSocketcreateServerSocketSSL(int port, KeyMgmt keys) static ServerSocketcreateServerSocketSSL(KeyMgmt keys) static char[]static StringcreateString(char[] str) static URLstatic Stringstatic voiddeletePathEx(String path) Deletes a folder and all sub-files and folders.static booleanechoAppend(String str, String dst) static StringencoderURL(String url) static intendian(int x) static longendian(long x) static shortendian(short x) static booleaneof(InputStream f) static intExecutes a command and returns the exit code.static String[]expandArgs(String[] args) Expand arguments.static booleanfileclose(InputStream is) static booleanstatic FileOutputStreamfilecreate(String name) static FileOutputStreamfilecreateappend(String name) static booleanstatic intstatic FileInputStreamstatic booleanfileskip(InputStream is, int length) static StringFilters a string using a regex that is matched against each character.static longConverts engineering notation (KB, MB, GB, TB) value to long.static StringReturns system config path for system services.static Stringstatic Stringstatic Stringstatic Stringstatic intReturns line # of calling method.static InetAddressgetLocalAddress(DatagramPacket packet) Determines local IP address for an inbound DatagramPacketstatic Stringstatic StringReturns path component of a filenamestatic intgetPID()static StringgetRemoteMAC(String ip) Returns MAC address for a given IP4 address.static Stringstatic Stringstatic Stringstatic Stringstatic booleangrep(InputStream is, OutputStream os, String regex) static booleanstatic voidThis allows connections to untrusted hosts when using https:// with URLConnection.static booleanis64Bit()static final booleanisGraal()static booleanChecks if system is jfLinux only.static booleanisMac()Checks if system is Mac only.static booleanisUnix()Checks if system is Unix based (includes : Unix, Linux, Mac, jfLinux)static booleanisWildcard(String wcstr) static booleanChecks if system is Windows only.static StringJoins array of strings placing a delimit in between each string.static StringJoins array of strings placing a delimit in between each string.static voidstatic booleanmemcmp(byte[] m1, int m1pos, byte[] m2, int m2pos, int len) static voidstatic booleanmemicmp(byte[] m1, int m1pos, byte[] m2, int m2pos, int len) static booleanstatic voidstatic voidstatic voidstatic voidstatic intread(InputStream in) static intread(InputStream in, byte[] buf, int pos, int len) static byte[]read(InputStream in, int max) static byte[]readAll(InputStream in) static booleanreadAll(InputStream in, byte[] buf, int pos, int len) static byte[]readAll(InputStream in, int len) static byte[]readAll(InputStream in, Socket s) static booleanreadAll(RandomAccessFile in, byte[] buf, int pos, int len) static charreadchar(InputStream in) static doublestatic floatreadfloat(InputStream in) static Stringstatic Objectstatic ObjectreadObject(String file) static intstatic intstatic longstatic intreaduint8(InputStream in) static Stringstatic voidsetCurrentPath(String new_dir) This just changes the internal value returned from getCurrentPath()static voidsetJavaAppHome(String value) static voidsleep(int milli) static String[]splitQuoted(String in, char token) static char[]strcat(char[] str, char ch) static char[]strcat(char[] s1, char[] s2) static booleanstrcmp(char[] s1, char[] s2) static booleanstatic char[]strcpy(char[] str) static booleanstricmp(char[] s1, char[] s2) static booleanstatic StringtoEng(long size) Converts long to engineering notation (KB, MB, GB, TB).static char[]truncstr(char[] str, int newlength) static voidUnzips zip file into path.static booleanwildcardCompare(String fnstr, String wcstr, boolean caseSensitive) static booleanwrite(OutputStream out, byte[] data) static booleanwrite(OutputStream out, byte[] data, int offset, int length) static booleanwrite(OutputStream out, String str) static booleanwritedouble(OutputStream out, double data) static booleanwritefloat(OutputStream out, float data) static voidwriteObject(Object obj, OutputStream os) static voidwriteObject(Object obj, String file) static booleanwriteuint16(OutputStream out, int data) static booleanwriteuint32(OutputStream out, int data) static booleanwriteuint64(OutputStream out, long data) static booleanwriteuint8(OutputStream out, int data) static voidZips path into zip file.
-
Field Details
-
isGraal
public static final boolean isGraal -
java_app_home
-
filter_alpha
Filter regex for any letter. -
filter_numeric
Filter regex for any number. -
filter_hex
Filter regex for any hex number. -
filter_alpha_numeric
Filter regex for any letter or number. -
digits
public static final char[] digitsCopy of Integer.digits -
StringArrayType
-
-
Constructor Details
-
JF
public JF()
-
-
Method Details
-
getVersion
-
main
-
isGraal
public static final boolean isGraal() -
sleep
public static void sleep(int milli) -
msg
-
createURL
-
cleanURL
Removes user info from any URL. -
readURL
-
encoderURL
-
decodeURL
-
atoi
-
atof
-
atox
-
isWindows
public static boolean isWindows()Checks if system is Windows only. -
isUnix
public static boolean isUnix()Checks if system is Unix based (includes : Unix, Linux, Mac, jfLinux) -
isMac
public static boolean isMac()Checks if system is Mac only. -
isJFLinux
public static boolean isJFLinux()Checks if system is jfLinux only. -
getUserPath
-
getCurrentUser
-
getTempPath
-
getCurrentPath
-
setCurrentPath
This just changes the internal value returned from getCurrentPath() -
getConfigPath
Returns system config path for system services. -
getLogPath
-
getExecExt
-
getScriptExt
-
printEnvironment
public static void printEnvironment() -
printProperties
public static void printProperties() -
eof
-
filelength
-
fileskip
-
fileflush
-
fileopen
-
filecreate
-
filecreateappend
-
fileclose
-
fileclose
-
read
-
readAll
-
readAll
-
readAll
-
readAll
-
readAll
-
read
-
read
-
readchar
-
readuint8
-
readuint16
-
readuint32
-
readuint64
-
readfloat
-
readdouble
-
write
-
write
-
write
-
writeuint8
-
writeuint16
-
writeuint32
-
writeuint64
-
writefloat
-
writedouble
-
copyAll
-
copyAll
-
copyAllAppend
-
echoAppend
-
copyAll
-
isWildcard
-
wildcardCompare
-
createstr
-
truncstr
public static char[] truncstr(char[] str, int newlength) -
strcpy
public static char[] strcpy(char[] str) -
strcat
public static char[] strcat(char[] s1, char[] s2) -
strcat
public static char[] strcat(char[] str, char ch) -
createString
-
strcmp
-
stricmp
-
strcmp
public static boolean strcmp(char[] s1, char[] s2) -
stricmp
public static boolean stricmp(char[] s1, char[] s2) -
memcpy
-
memcmp
public static boolean memcmp(byte[] m1, int m1pos, byte[] m2, int m2pos, int len) -
memicmp
public static boolean memicmp(byte[] m1, int m1pos, byte[] m2, int m2pos, int len) -
getJARPath
-
randomize
-
endian
public static short endian(short x) -
endian
public static int endian(int x) -
endian
public static long endian(long x) -
getPID
public static int getPID() -
copyOfExcluding
public static <T> T[] copyOfExcluding(T[] array, int idx) -
copyOfExcluding
public static boolean[] copyOfExcluding(boolean[] array, int idx) -
copyOfExcluding
public static byte[] copyOfExcluding(byte[] array, int idx) -
copyOfExcluding
public static short[] copyOfExcluding(short[] array, int idx) -
copyOfExcluding
public static int[] copyOfExcluding(int[] array, int idx) -
copyOfExcluding
public static float[] copyOfExcluding(float[] array, int idx) -
copyOfExcluding
public static double[] copyOfExcluding(double[] array, int idx) -
copyOfExcluding
public static char[] copyOfExcluding(char[] array, int idx) -
copyOfInsert
public static <T> T[] copyOfInsert(T[] array, int idx, T insert) -
copyOfInsert
public static boolean[] copyOfInsert(boolean[] array, int idx, boolean insert) -
copyOfInsert
public static byte[] copyOfInsert(byte[] array, int idx, byte insert) -
copyOfInsert
public static short[] copyOfInsert(short[] array, int idx, short insert) -
copyOfInsert
public static int[] copyOfInsert(int[] array, int idx, int insert) -
copyOfInsert
public static long[] copyOfInsert(long[] array, int idx, long insert) -
copyOfInsert
public static float[] copyOfInsert(float[] array, int idx, float insert) -
copyOfInsert
public static double[] copyOfInsert(double[] array, int idx, double insert) -
initHttps
public static void initHttps()This allows connections to untrusted hosts when using https:// with URLConnection. -
connectSSL
-
createServerSocketSSL
-
createServerSocketSSL
-
connectSSL
-
createServerSocketSSL
-
connectSSL
Upgrades existing socket to SSL. -
connectSSL
Upgrades existing socket to SSL (client side). -
getLineNumber
public static int getLineNumber()Returns line # of calling method. See http://stackoverflow.com/questions/115008/how-can-we-print-line-numbers-to-the-log-in-java -
join
Joins array of strings placing a delimit in between each string. -
join
Joins array of strings placing a delimit in between each string. -
expandArgs
Expand arguments. Performs argument globbing (wildcards). Used by native launcher. (same as sun.launcher.LauncherHelper) -
setJavaAppHome
-
is64Bit
public static boolean is64Bit() -
getPath
Returns path component of a filename -
deletePathEx
Deletes a folder and all sub-files and folders. -
zipPath
Zips path into zip file. -
unzip
Unzips zip file into path. -
splitQuoted
-
readLineQuoted
-
readObject
-
readObject
-
writeObject
-
writeObject
-
getLocalAddress
Determines local IP address for an inbound DatagramPacket -
getRemoteMAC
Returns MAC address for a given IP4 address. Supports only clients on same LAN. Uses the 'arp' command. -
filter
Filters a string using a regex that is matched against each character. See filter_alpha, filter_alpha_number, etc. -
exec
Executes a command and returns the exit code. -
toEng
Converts long to engineering notation (KB, MB, GB, TB). -
fromEng
Converts engineering notation (KB, MB, GB, TB) value to long. -
moveFile
-
copyFile
-
grep
-
grep
-