B4J Library New library for b4J: Firebase, Upload, Files, SQL, Thymeleaf, Bytes, String, Security, Double

Allow me to introduce you to the library that I am developing for use in our clients' web app projects.
Currently, the library is still under development, but I will introduce a few small components first and will gradually update them in the future.
  • Part 1: Firebase Services class for jServer
1- Below is the JavaScript code when the user clicks on the button to log in with their Facebook or Google account.

B4X:
 <script src="https://www.gstatic.com/firebasejs/8.0.0/firebase-app.js"></script>
  <script src="https://www.gstatic.com/firebasejs/8.0.0/firebase-auth.js"></script>
 
  <script>
    var firebaseConfig = {
      apiKey: "...",
      authDomain: "...",
      projectId: "...",
      appId: "..."
    };
    firebase.initializeApp(firebaseConfig);
  </script>
 
  <script>
 
function signInWithGoogle() {
  var provider = new firebase.auth.GoogleAuthProvider();
  firebase.auth().signInWithPopup(provider)
    .then((result) => {
      firebase.auth().currentUser.getIdToken(true).then(function(idToken) {
          var token = idToken;
          b4j_raiseEvent('event_register', {tk:token});
      }).catch(function(error) {
 
      });
    })
    .catch((error) => {
 
    });
}
// Facebook sign-in function
function signInWithFacebook() {
  var provider = new firebase.auth.FacebookAuthProvider();
  firebase.auth().signInWithPopup(provider)
    .then((result) => {
      firebase.auth().currentUser.getIdToken(true).then(function(idToken) {
        var token = idToken;
        b4j_raiseEvent('event_register', {tk:token});
      }).catch(function(error) {
 
      });
    })
    .catch((error) => {
    });
}

  </script>

2-Next, we will add the necessary libraries to the project.

B4X:
#AdditionalJar: commons-codec-1.3.jar
#AdditionalJar: commons-compress-1.21.jar
#AdditionalJar: commons-io-2.11.0.jar
#AdditionalJar: commons-logging-1.1.1.jar
#AdditionalJar: firebase-admin-9.2.0.jar
#AdditionalJar: google-api-client-1.21.0.jar
#AdditionalJar: google-http-client-1.19.0.jar
#AdditionalJar: google-http-client-gson-1.21.0.jar
#AdditionalJar: google-http-client-jackson2-1.19.0.jar
#AdditionalJar: gson-2.6.2.jar
#AdditionalJar: guava-jdk5-17.0.jar
#AdditionalJar: httpclient-4.0.1.jar
#AdditionalJar: httpcore-4.0.1.jar
#AdditionalJar: google-oauth-client-1.21.0.jar
#AdditionalJar: jackson-core-2.1.3.jar
#AdditionalJar: javax.inject-1.jar
#AdditionalJar: json-20160212.jar
#AdditionalJar: jsr305-1.3.9.jar
#AdditionalJar: xz-1.9.jar
#AdditionalJar: snappy-0.4.jar
#AdditionalJar: slf4j-api-1.7.36.jar
#AdditionalJar: sisu-inject-plexus-1.4.2.jar
#AdditionalJar: sisu-inject-bean-1.4.2.jar
#AdditionalJar: api-common-2.12.0.jar
#AdditionalJar: google-auth-library-oauth2-http-1.19.0
#AdditionalJar: google-auth-library-credentials-1.19.0.jar
#AdditionalJar: guava-23.2-jre

3- When we receive the user token from Firebase, we will send the token to a socket server for verification.

B4X:
Sub event_register(variable As Map)
    Log("CONNECTED")
    Dim token As String = variable.Get("tk")
 
    Log(token)
    Dim firetoken As jFirebaseAuthWrapper
    Dim auth As String = File.Combine(File.DirApp, "firebase.json")
    firetoken.Initialize("firebaseauth", auth)
    firetoken.verifyIdToken(token)
End Sub

Sub firebaseauth_tokenverified (Token As Map)
    Log(Token.Get("getEmail"))
    Log(Token.Get("getIssuer"))
    Log(Token.Get("getName"))
    Log(Token.Get("getPicture"))
    Log(Token.Get("getTenantId"))
    Log(Token.Get("getUid"))
    Log(Token.Get("isEmailVerified"))
    'https://thienvienphuocson-69b69-default-rtdb.asia-southeast1.firebasedatabase.app
End Sub
Sub event_register(variable As Map)
    Log("CONNECTED")
    Dim token As String = variable.Get("tk")
 
    Log(token)
    Dim firetoken As jFirebaseAuthWrapper
    Dim auth As String = File.Combine(File.DirApp, "firebase.json")
    firetoken.Initialize("firebaseauth", auth)
    firetoken.verifyIdToken(token)
End Sub

Sub firebaseauth_tokenverified (Token As Map)
    Log(Token.Get("getEmail"))
    Log(Token.Get("getIssuer"))
    Log(Token.Get("getName"))
    Log(Token.Get("getPicture"))
    Log(Token.Get("getTenantId"))
    Log(Token.Get("getUid"))
    Log(Token.Get("isEmailVerified"))
    'https://thienvienphuocson-69b69-default-rtdb.asia-southeast1.firebasedatabase.app
End Sub

* Extend java library: * Extend java library for jFileSupport, jByteSupport, jDoubleSupport, jFileSupport, jSecuritySupport:

Source code here: https://github.com/tummosoft/jFileSupport
 

Attachments

  • Thymeleaf.zip
    20.2 KB · Views: 97
  • FirebaseAuth- B4j.zip
    43.3 KB · Views: 85
  • Firebase Test.zip
    11.5 KB · Views: 74
  • jSQLSupport.zip
    17.1 KB · Views: 86
  • Test jSQLSupport.zip
    7.4 KB · Views: 83
  • ThymeleafSupport (b4j).zip
    3 KB · Views: 74
  • jFileSupport_105.zip
    25.6 KB · Views: 48
  • jFileSupport_153.zip
    52.9 KB · Views: 45
Last edited:

tummosoft

Member
Licensed User
Longtime User
Part 2: Thymeleaf template Engines for B4J

Themeleaf documents:
https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html

-AdditionalJar:
AdditionalJar:
#AdditionalJar: thymeleaf-3.1.1.RELEASE.jar
#AdditionalJar: ognl-3.3.4.jar
#AdditionalJar: javassist-3.29.0-GA
#AdditionalJar: attoparser-2.0.6.RELEASE
#AdditionalJar: unbescape-1.1.6.RELEASE
#AdditionalJar: sqlite-jdbc-3.42.0.0

- Step 1: Create a Thymeleaf template:

Thymeleaf template:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<head>
<title th:text="${pagetitle}"></title>
<meta name="description" th:content="${des}"/>
<meta property="og:description" th:content="${vietnamese}" />
<link rel="canonical" th:href="${canonical}"/>
</head>
    <body>
    <h1 th:text="${h1}"></h1>
        
    <div th:if="${is_caculator == true}">
     <p><span>X1 + X2 = </span><span th:text="${x1 + x2}"></span></p>
    </div>
    
    <h2>LOOOOOOOP</h2>
    <ul th:each="myarr: ${myarrs}">
        <li  th:text="${myarr}"></li>
    </ul>
    
</div> 
</body>
</html>

- Step 3: Rending

B4X:
Dim Thymeleaf As ThymeleafSupport
    Dim ThymeleafTemplate As String = File.Combine(File.DirApp & "/www/templates","template1.htm")
    Dim variable As Map
    variable.Initialize
    variable.Put("date", DateTime.Date(DateTime.Now))
    variable.Put("uri", "https://tummosoft.com")
    variable.Put("user", myUser.User)
    variable.Put("roles", myUser.Roles)
    variable.Put("logout", "/logout.do")
    
    Thymeleaf.Initialize
    Thymeleaf.Encoding = "UTF-8"
    Thymeleaf.Cacheable = True
    '1200000L // TTL=20m
    Thymeleaf.CacheTTLMs = 1200000
    Thymeleaf.Variables = variable
    
    Thymeleaf.setVariable("pagetitle","Hello world")
    Thymeleaf.setVariable("des","单词意思是灵活的意思")
    Thymeleaf.setVariable("canonical","http://127.0.0.1/home")    
    Thymeleaf.setVariable("vietnamese","Xin chào các bạn!!!")
    
    Dim map2 As Map
    map2.Initialize
    
    Dim x1 As Int = 3
    Dim x2 As Int = 4
    
    map2.Put("h1", "This is h1 tag")
    map2.Put("is_caculator", True)
    map2.Put("x1", x1)
    map2.Put("x2", x2)
    
    Thymeleaf.Variables = map2
    
    Dim arr() As String = Array As String ("Monday","Tuesday", "Wednesday", "Thursday", "Friday")
    Thymeleaf.setVariable("myarrs", arr)
    
    Dim info As infoData
    info.Initialize
    info.Name = "DAVID"
    info.Age = "25"
    Thymeleaf.setVariable("authors", info)
    
    Dim html As String = Thymeleaf.toHTML(ThymeleafTemplate)
        
    'Log(html)
    resp.CharacterEncoding = "UTF-8"
    resp.Write(html)

Library and example project on post 1:
 
Last edited:

tummosoft

Member
Licensed User
Longtime User
[Updated] ThymeleafSupport 1.22
------------------------------------
[1] Read .properties files from template:
- Set your Thymeleaf template and .properties files, there are two files with the same name in the same folder.
----------- [template1.properties files]
Template1.properties:
home.welcome=I am working with .properties file
logo=Good Thymes Virtual Grocery logo
date.format=MMMM dd'','' yyyy
home.custom=This is first tag, {0}, this this end tag

---------- [template1.html]
B4X:
    <h1 th:utext="#{home.welcome}"></h1>

[2] Define a Thymeleaf fragment
Footer fragment:
<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org">

  <body>
 
    <div th:fragment="copy">
      &copy; 2011 The Good Thymes Virtual Grocery
    </div>
 
  </body>
 
</html>

B4X:
<div th:insert="~{\footer::copy}"></div>

[3] New methods: Thymeleaf.Prefix, Thymeleaf.Suffix;

- The method Prefix will help define abosute path of templates file.

B4X:
Dim Thymeleaf As ThymeleafSupport
    Dim ThymeleafTemplate As String = File.Combine(File.DirApp & "/www/templates","")
   
    Thymeleaf.Initialize
    Thymeleaf.Encoding = "UTF-8"
    Thymeleaf.Cacheable = True
    '1200000L // TTL=20m
    Thymeleaf.CacheTTLMs = 1200000
    Thymeleaf.Prefix = ThymeleafTemplate
    Thymeleaf.Suffix = ".html"
' --------------------
Dim html As String = Thymeleaf.toHTML("/template1.html")

The examples was attached to 1st post!
 

tummosoft

Member
Licensed User
Longtime User

Using object's method from Thymeleaf​

B4X:
Type Animal(id As Int, name As String, action As String)

    Dim listAnimals As List
    listAnimals.Initialize
    
    Dim myAnimal As Animal
    myAnimal.Initialize
    myAnimal.id = 1
    myAnimal.name = "Dog"
    myAnimal.action = "Eat"
    
    listAnimals.Add(myAnimal)
    
    myAnimal.id = 1
    myAnimal.name = "Cat"
    myAnimal.action = "Sleeping"
    
    listAnimals.Add(myAnimal)
    
    Thymeleaf.setVariable("animals",listAnimals)

' HTML CODE
' ---------------------------------------
    <ul th:each="animal: ${animals}">
        <li><span th:text="${animal.id}"></span> - <span th:text="${animal.name}"></span> - <span th:text="${animal.action}"></span></li>
    </ul>
 

enrfortin

Member
Licensed User
Hi @tummosoft i am trying to use the first example to log in users with google and facebook but i have a couple of problems i can't find these aditional .jar files

#AdditionalJar: firebase-sdk-bundled.jar
#AdditionalJar: google-api-bundled.jar
I also have problems with
B4X:
Dim firebase As jServicesSupport
Do I need any additional libraries?
i all ready get JSPSupport library and the 5 .jar files shared on JavaLib tab
 

tummosoft

Member
Licensed User
Longtime User
Hi @tummosoft i am trying to use the first example to log in users with google and facebook but i have a couple of problems i can't find these aditional .jar files


I also have problems with
B4X:
Dim firebase As jServicesSupport
Do I need any additional libraries?
i all ready get JSPSupport library and the 5 .jar files shared on JavaLib tab

I updated B4j lib, B4j example and extend .jar libraries. You can download now:
Extends libraries:
Note: You must run test with a domain registered on Firebase (example: http://localhost/login)

AdditionalJar:
#AdditionalJar: commons-codec-1.3.jar
#AdditionalJar: commons-compress-1.21.jar
#AdditionalJar: commons-io-2.11.0.jar
#AdditionalJar: commons-logging-1.1.1.jar
#AdditionalJar: firebase-admin-9.2.0.jar
#AdditionalJar: google-api-client-1.21.0.jar
#AdditionalJar: google-http-client-1.19.0.jar
#AdditionalJar: google-http-client-gson-1.21.0.jar
#AdditionalJar: google-http-client-jackson2-1.19.0.jar
#AdditionalJar: gson-2.6.2.jar
#AdditionalJar: guava-jdk5-17.0.jar
#AdditionalJar: httpclient-4.0.1.jar
#AdditionalJar: httpcore-4.0.1.jar
#AdditionalJar: google-oauth-client-1.21.0.jar
#AdditionalJar: jackson-core-2.1.3.jar
#AdditionalJar: javax.inject-1.jar
#AdditionalJar: json-20160212.jar
#AdditionalJar: jsr305-1.3.9.jar
#AdditionalJar: xz-1.9.jar
#AdditionalJar: snappy-0.4.jar
#AdditionalJar: slf4j-api-1.7.36.jar
#AdditionalJar: sisu-inject-plexus-1.4.2.jar
#AdditionalJar: sisu-inject-bean-1.4.2.jar
#AdditionalJar: api-common-2.12.0.jar
#AdditionalJar: google-auth-library-oauth2-http-1.19.0
#AdditionalJar: google-auth-library-credentials-1.19.0.jar
#AdditionalJar: guava-23.2-jre

B4J Code:
Sub event_register(variable As Map)
    Log("CONNECTED")
    Dim token As String = variable.Get("tk")
   
    Log(token)
    Dim firetoken As jFirebaseAuthWrapper
    Dim auth As String = File.Combine(File.DirApp, "firebase.json")
    firetoken.Initialize("firebaseauth", auth)
    firetoken.verifyIdToken(token)
End Sub

Sub firebaseauth_tokenverified (Token As Map)
    Log(Token.Get("getEmail"))
    Log(Token.Get("getIssuer"))
    Log(Token.Get("getName"))
    Log(Token.Get("getPicture"))
    Log(Token.Get("getTenantId"))
    Log(Token.Get("getUid"))
    Log(Token.Get("isEmailVerified"))
    'https://thienvienphuocson-69b69-default-rtdb.asia-southeast1.firebasedatabase.app
End Sub
 

Attachments

  • FirebaseAuth- B4j.zip
    43.3 KB · Views: 88
  • Firebase Test.zip
    11.5 KB · Views: 86
Last edited:

tummosoft

Member
Licensed User
Longtime User
Part 3: jFileSupport library

The jFileSupport library has been modified by me from the B4J library, primarily to provide Unicode support and incorporate a few other necessary functions for the purpose of designing applications that operate as web servers.

#AdditionalJar:
#AdditionalJar: commons-codec-1.16.0.jar

- Reading and writing config file (map) with Unicode

ReadMapUnicode:
Dim jFile As jFileSupport
    
    Dim unicodeMap As Map = jFile.ReadMapUnicode(File.DirApp & "/MapUnicode", "tiếng-việt.txt")
        
    For i=0 To unicodeMap.Size - 1
        Log(unicodeMap.GetValueAt(i))
    Next
    
    jFile.WriteMap(File.DirApp & "/MapUnicode", "writeUTF-8.txt", unicodeMap)

- Read file meta data

FileMetadata:
Dim jFile As jFileSupport
    Dim path As String = File.Combine("C:\Users\Admin\Documents", "cmnd1.jpg")
    Dim m1 As String = jFile.FileMetadataToJson(path)

- Read checksum
B4X:
Dim checksum As String = jFile.getFileChecksum("C:\Users\Admin\Documents", "cmnd1.jpg")
    Log(checksum)

- Rename File
RennameFile:
jFile.RennameFile(source, target)

- Set Permissions (only Linux)

Set Permissions:
jFile.setFilePermissions(target, "rwxr-x---")
    jFile.setDirectoryPermissions(target, "rw-------")
 

Attachments

  • Examples.zip
    3.8 KB · Views: 77
  • jFileSupport (B4J).zip
    16.6 KB · Views: 81
  • jFileSupport Extend (Jar).zip
    295.4 KB · Views: 90

tummosoft

Member
Licensed User
Longtime User
Part 4: jFileUploadSupport - Simple way to upload multiple files to b4j server

jFileUploadSupport
was wrapped from org.apache.commons.fileupload2.jakarta library, it can help to easy to upload files to server.

Additional Jar:
#AdditionalJar: commons-fileupload2-core-2.0.0-M1
#AdditionalJar: commons-fileupload2-jakarta-2.0.0-M1
#AdditionalJar: commons-io-2.13.0

Multipart File Upload:
<!DOCTYPE html>
<html>
<body>
<div class="container">
        <h1>Multipart File Upload</h1>
        <form id="form" enctype="multipart/form-data">
            <div class="input-group">
                <label for="files">Select files</label>
                <input id="file" type="file" multiple />
            </div>
            <button class="submit-btn" type="submit">Upload</button>
        </form>
    </div>
    <script>
    const form = document.getElementById("form");
const inputFile = document.getElementById("file");

const formData = new FormData();

const handleSubmit = (event) => {
    event.preventDefault();

    for (const file of inputFile.files) {
        formData.append("files", file);
    }

    fetch("http://localhost/upload/v2/id=file", {
        method: "post",
        body: formData,
    }).catch((error) => ("Something went wrong!", error));
};

form.addEventListener("submit", handleSubmit);
    </script>
</body>
</html>

Upload Server:
Sub Handle(req As ServletRequest, resp As ServletResponse)
    Dim jupload As jFileUploadSupport
    
    jupload.Initialize("jupload")   
    Dim pathUpload As String = File.Combine(File.DirApp & "/www","")
    jupload.TempFile(File.DirApp & "/www", "Multipart.temp")
    jupload.UploadPath(pathUpload)
    jupload.MultipartHook(req)
End Sub

Sub jupload_UploadProgress (TotalKB As Long, Percent As String)
    Log(TotalKB)
    Log(Percent)
End Sub

Sub jupload_UploadCompleted(Success As Boolean, FileName As String)   
    Log(FileName)
    Log(Success)
End Sub
 

Attachments

  • jFileUploadSupport - Extend Jar.zip
    493.3 KB · Views: 86
  • jFileUploadSupport - b4j.zip
    4.7 KB · Views: 85
  • jFileUploadSupport - Examples.zip
    50.1 KB · Views: 80

tummosoft

Member
Licensed User
Longtime User
[updated] jFileSupport - v 1.41
* Add function: recognizedSignatures
When your website allow user upload document, the server will face various events: ativrius,harm files... Therefore, recognizedSignatures will help you check the sign of document when user upload and it can make decision: keep files or delete them.

You can find the sign of any files on there: https://en.wikipedia.org/wiki/List_of_file_signatures, and put them it on to array: Array As String("89504E","504B03","000001")

jFileSupport:
Dim jFile As jFileSupport
    Dim path As String = File.Combine("C:\Users\Admin\Downloads", "laco.png")
    jFile.recognizedSignatures = Array As String("89504E","504B03","000001") 
    Dim rs As Int = jFile.CheckFileSignatures(path)
    Log(rs)

result = 0; -> File type is recognized
result = 1; -> File type is not recognized
result = 2; -> File is too short to determine the signature.

* Other function:
- jFile.ReadAllFolderToJson
- jFile.ReadAllInFolderToXML
 

Attachments

  • jFileSupport 1.41.zip
    19 KB · Views: 72
Last edited:

tummosoft

Member
Licensed User
Longtime User
[Part 4] jSQLSupport
jSQLSupport is a library was modify by me from Erel's lib (jSQL).
I added some functional accessory:
- Integrated HikariCP, H2 Database Server, H2 Database
* If you want to use the Hikaricp pool, please set h2database.HikariEnable(True)
Extends Java libs:
H2 Database Server:
Dim h2server As jH2Server
Dim hpathdata As String = File.Combine(File.DirApp,"")
    h2server.InitializeServer("3005", "sa", hpathdata)
    Log(h2server.URL)
    url = h2server.URL

B4X:
Dim h2database As jSQLSupport
    h2database.ExecNonQuery("CREATE TABLE table1 (col1 TEXT , col2 INTEGER, col3 INTEGER)")
    For i=0 To 10
        h2database.ExecNonQuery2("INSERT INTO table1 VALUES(?,?,?)", Array As Object(i, i*2, i*3))
    Next

* Note: If you will use H2 Database like as TCP Server. First, you must create a database on your hard disk. After, using this database for TCP Server.

B4X:
Dim jdbc As String = "jdbc:h2:file:"
h2database.InitializeH2("org.h2.Driver", jdbc, "tummosoft", "sa", "sa", 8192)

B4X:
Dim hpathdata As String = File.Combine(File.DirApp,"")
    hpathdata = hpathdata.Replace("\", "/")
    Dim jdbc As String = "jdbc:h2:" & url & "/" & hpathdata
    
    h2database.InitializeH2("org.h2.Driver", jdbc, "tummosoft", "sa", "sa", 8192)
    h2database.HikariEnable(True)
 

Attachments

  • Test jSQLSupport.zip
    7.4 KB · Views: 78
  • jSQLSupport.zip
    17.1 KB · Views: 89

tummosoft

Member
Licensed User
Longtime User
[updated] jFileSupport 1.42
----------------
This updated version of jFileSupport there are two functions added to its.
- MAPtoJSON: Convert Map to JSON;
- ObjectClassToJSON: Convert object class to json.

ObjectClass to JSON:
Type Row(id As String, cell As Plan)
Type Plan(hours As String, day As String, content As String, name As String)

Dim vrow As Row
vrow.Initialize
vrow.id = RS.GetString("id")
' ---------'   
Dim item As Plan
item.Initialize   
item.hours = hours
item.day = day

vrow.cell = item           
result.Add(vrow)

' --------------------
'--------------------

JSON:
[
    {
        "IsInitialized": true,
        "id": "1",
        "cell": {
            "IsInitialized": true,
            "hours": "08:00",
            "day": "24-06-2023",       
            "datasrc": "/images/hinhnhanvien/hinh1.jpg"
        }
    },
 

Attachments

  • jFileSupport_1.42.zip
    19.3 KB · Views: 78

tummosoft

Member
Licensed User
Longtime User
[updated] jFileSupport 1.52
********
This is a new update for the jFileSupport library. On the new version, there are some new methods:
(Download extend jars: )
--------------------------------
bytesToHexString(src() byte) As String
BytesToINT(bt() As Byte) As Int
ByteToINT(byte As Byte) As Int
convertToUTF16Escape(utf8 As String) As String
decode(bt() As Byte, path As String, filename As String)
format_str(value bint, len As Int) As String
fromHex(hex As String) As Byte()
getFileEncode(filename As String) As String
getFileType(filename As String) As String
getPrefix(filename As String) As String
IntToBytes(value As Int) As Byte()
isBinaryFile(filename As String) As Boolean
isPdf(filename As String) As Boolean
InputStream2String(filename As InputStream) As String
rightPad(value As String, len As Int, c As Char) As String
BytestoHex(bt As Byte())
 

Attachments

  • jFileSupport_105.zip
    25.6 KB · Views: 43

tummosoft

Member
Licensed User
Longtime User
In this new updated of this version, there are few changes on jFlieSupport static class. And I also added many method functions as follows:
**** Extends jar:
* jFileSupport: This static class include method functions:
jFileSupport:
- writeFile(filename as String, data() as byte)
- mergeFiles(file1 as String, file2 as String, targetFile as String) as boolean
- mergeFiles2(listFile as List, target as String) as boolean
- splitFileByBytesNumber(fileSplit as String, prefixFileName as String, bytesNumber as long)
- getFontFile(path as String, fontName as String) as string
- countDirectorySize(folder as String, countSubdir as boolean) as long()
- deleteDir(dir as string) as boolean
- clearDir(folder as String) as boolean
- sortFiles(files as List, sortMode as FileSortMode)
- appendName(filename as String, inStr as String) as String
- replaceFileSuffix(filename as String, newSuffix as String) as String

* jStringSupport: This static class include method functions:
[B] jStringSupport[/B]:
- SeparatedBySpace(String string) as string()
- splitBySpace() as string()
- splitByComma() as string
- fillLeftZero(value as int, digit as int) as string
- fillRightZero(value as int,digit as int) as string
- fillRightBlank(value as int, digit as int) as string
- leftAlgin(name as String, value as String, int nameLength) as string
- replaceAll(value String, oldString as String, newString as String) as string
- match(value as String, regex as String) as boolean
- lastRegex(value as String, regex as String) as int
- firstRegex(value as String, regex as String) as int
- countNumberRegex(value as String, regex as String) as int
- decodeUnicode(String unicode) as string
 encodeUnicode(value as String) as String

* jDoubleSupport: This static class include method functions:
jDoubleSupport:
- scale3 (value1 as double, value2 as double) as double
- scale2 (value1 as double, value2 as double) as double
- scale6 (value1 as double, value2 as double) as double
- sortList (List item) as List
- sortArray (Double() item) as Double()
- getPercentage (value1 as double, value2 as double) as double
- compare (double d1, double d2, boolean desc)  as double
- random ()  as double

* jByteSupport: This static class include method functions:
jByteSupport:
- bytesToInt (value() as byte) as int
- bytesToUshort (value() as byte)  as int
- intToBytes (value as int) as byte()
- intSmallByte  (value as int) as byte()
- intBigByte  (value as int) as byte()
- unsignedShortToBytes  (value as int) as byte()
- shortToBytes  (value as short) as byte()
- byteToHex (value() as byte) as string
- bytesToHex (value() as byte) as string
- stringToHexFormat  (value as String) as String
- bytesToHexFormatWithCF (value() as byte) as String
- bytesToHexFormat (value() as byte) as String
- bytesToHexFormat2 (value() as byte) as String
- hexToBytes (value as String) as byte()
- hexToByte  (value as String) as byte
- hexToByteAnyway  (value as String) as byte()
- hexToInt (value as String) as as int
- validateByteHex (value as Object) as byte()
- isByteHex (value() as byte)
- isBytesHex (value() as byte)
- validateTextHex
- hexToBytesAnyway (value as Object) as byte()
- hexFormatToBytes (value as Object) as byte()
- subBytes (value() as byte)
- mergeBytes (value() as byte)
- countNumber () as int
- lineIndex () as int
- indexOf () as int
- GetByteFromHex (value as String)
- bytesToHexString (value() as byte)
- ByteToINT (value as byte)
- formatHex (value as String)
- checkBytesValue (value() as byte)
- deflate (value() as byte)
- inflate (value() as byte)
- ObjectToBytes (value as Object) as byte()
- BytesToObject (value() as byte) as object


* jSecuritySupport: This static class include method functions:
jSecuritySupport:
- jreVersion as float
- isLinux as boolean
- isMac as boolean
- isWindows as boolean
- getAvaliableMemory as long
- SignatureAlgorithms:
- getMD5 as byte(), getSHA1 as byte(), getSHA256 as byte()
 

Attachments

  • jFileSupport_153.zip
    52.9 KB · Views: 49
Top