Class Collection

A collection of JAVA classes and methods i think is useful.
Have not done anything on this for a long time so it is kind of dead :-(
See the class description below for more information on what SteelsquidClassCollection can do.

Here you can download the code: Google Drive

Dependencies (All needed jar is under the lib directory)

Java 1.6
Jsoup, If you use JsoupConnector (


Here you can download the project.


For example see package: org.steelsquid.classcollection.example and the class description below.

Short description of classes

Some of the examples do not work untill you edit them for your system.
Here is a short description of the examples:
- Sending a mail.
- Testing some functions in the prophandler (Load properties from xml file easy).
- Crypt/decrypt a stream with DES.
- Print text to printer.
- Read and write to console (formating the output and input).
- Creating and extracting a zip-file.
- Set classpath and library path in runtime. (The same as the -classpath and -Djava.library.path).
- Settings temp properties. (Usefull if you want to save some values while restarting a application).
- Sending, receiving and listing file on ftp server.
- List files in a directory (recursively and a lot of filtering).
- Test to start the steelsquidServer from inside a java program (SteelsquidServer se below).
- Read response from a web page.
- Get the external ip you have on the internet.
- A test application for SteelsquidServer.

Under the etc directory you can find the properties xml file you
need to run the example (exampleProp.xml).
How to run example:
java -classpath ../lib/SteelsquidClassCollection.jar org.steelsquid.classcollection.example.Exec ../etc/exampleProp.xml
Contains som usefull methods.
Se doc/javadoc/index.html for more inforamtion.
- Check if a string is empty.
- Cut up string into certain length. stringCutUp("abcdefgh",3 ) => abc def gh
- Replace invalide xml chars
- Get String between two other Strings. getStringBetweanStrings("aabbbcc", "aa", "cc") ==> bbb
- Replace String between two other Strings. replaceStringBetweanStrings("aabbbcc", "aa", "cc", "ddd") ==> aadddcc
- If execute getVariables("Hellow ", alist) firsname and lastname will be added to alist.
- If execute setVariables("Hellow , "name", "steelsquid") will replace with steelsquid.
- Generade a nice locking log string: [id] yyyy-MM-dd hh:mm:ss [Level] [text]
- Break a string into tokens, stringTokenizer("hej|hopp||1|") ==> 'hej', 'hopp', '', '1', '' (also returns empty tokens)
- Get random integer and string.
- Copy from one stream to a nother.
- Replace all occurences of text with another in a StringBuilder.
- Get firstIndexOf and lastIndexOf char in a StringBulder
Contains som usefull methods for the console.
Read, write, delete, backspace, clearScreen.
Also use nice locking string from org.steelsquid.classcollection.common.Utils
Se doc/javadoc/index.html for more inforamtion.
Read, write, create, move copy, delete and other stuff on files.
Se doc/javadoc/index.html for more inforamtion.
- Change attribute on file
- Walk a directory tree and return a List of files/directorys, can set a lot of filterng options (Se org.steelsquid.classcollection.example)
- Delete a file/directory recursively.
- Copy file or a dir. Copy recursively if a directory.
- Move file or a dir.
- Reading text content of a file.
- Writing a text to a file.
- Writing a stream to a file.
- Read text from file in classpath.
- Check if a file/dir is a link i unix/linux and windows (Do not know if this always work).
- Check if a file/directory is sub directory of other directory and some other security checks to.
Usefull things to handle date and time.
Se doc/javadoc/index.html for more inforamtion.
- Check if date is valide.
- Get current date and time yyyy-MM-dd and HH:mm:ss
- Parse and format date thread safe (yyyy-MM-dd and HH:mm:ss).
- Creates a zip and add a directory content to it
- Extract zip file to a directory
- Load jar and set library path in runtime. (The same as the -classpat and -Djava.library.path)
A very simple class to send/receive text to/from a socket server.
- Sending, receiving and listing file on ftp server
- Read a html request from a server.
- Check if port is free to use.
- Get ip-number you have on the net.
- Send a mail
- Write text to a printer
- Loading properties to application easy.
- Use DES to encrypt and decrypt a stream
- Can use password or key-file
A easy to use package to use if you want to create small applications fast.
- Configure the server by xml.
- One server can contains multipple applications.
- Send command by telnet to all applications.
- You override this methods to do the work: onStart, running, onStop, onStopped, onException, onCommand

Expecting xml properties file as input parameter (Se etc/exampleServerSettings.xml)

You can test SteelsquidServer like this:
java -classpath ../lib/steelsquidClassCollection.jar org.steelsquid.classcollection.server.Server ../etc/exampleServerSettings.xml

You can also send command to a server on localhost like this (A command will be sent to all applications on the server onCommand(...)):
java -classpath ../lib/steelsquidClassCollection.jar org.steelsquid.classcollection.server.Server ../etc/exampleServerSettings.xml This is a command
A command is a string ending with \n (new line)
You can also use telnet to send a command. Print your command followed by Enter.
If multiple applications return answer they will be merged.
The answer will always end with \n (new line)
This class uses jsoup to parse html.
Hidden fields, cookies and permanent parameters.
Cookies will be read from the server response and moved to the next server request.
If the server response has hidden fields they will be moved to the next server request.
You can also set permanent paramaters that will be sent on every server request.


Stop, start and restart application in SteelsquidServer