kLib

kLib is a in Kotlin written Library by ATVG-Studios containing a set of useful Functions, Extensions and Types.

Currently: 3.1.0 (13th June 2019)

Features

kLib has many useful extensions for existing classes in the JDK or Kotlin STD.

We are counting:

Type Amount Type Amount
Annotations 1 Dummy Classes 1
Exceptions 4 Extension Functions 71
Top-Level Functions 11 Interface Classes 2
Objects 6 Type-Aliases 2
Types 8 Extension Properties 4

Our features go from Extensions

val myList = mutableListOf(1,2,3,4,5) // Create a normal MutableList
myList.swap(1,4) // Swap index 1 with index 4 (Using kLib.extensions.swap)
println(myList) // [1,5,3,4,2]
      

to more Extensions and helper Objects

val theHash = "This is a string".asSha256() // Hash the string with SHA256 (Using klib.extensions.asSha256)
val theHashInBase = Base58e.encode(theHash) // Encode the hex value into a Base58 string (Using klib.objects.base.Base58)
println(theHashInBase) // 6HkfLB6T8P9JzkLj5b81maxbpHHTyP4zY6VCU5YRx5xx
      

Reference to the used code: swap, asSha256, Base58e

These and many more features are part of kLib!

Maven Repository

kLib is now available via a custom Maven repository.
You can find the Git repository that hosts the Maven data here.
The Maven Repository itself is available here: https://mvn.osmium.software

Adding the latest version of kLib using Gradle:

repositories {
    maven { url 'https://mvn.osmium.software' }
}

dependencies {
    implementation "com.atvgstudios:klib:+"
}

Adding the latest version of kLib using Gradle.kts:

repositories {
    maven {
        url = uri("https://mvn.osmium.software")
    }
}

dependencies {
    implementation("com.atvgstudios:klib:+")
}

Adding the latest version of kLib using Maven:

<repositories>
  <repository>
    <id>atvg-studios</id>
    <name>ATVG-Studios Maven</name>
    <url>https://mvn.osmium.software</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>com.atvgstudios</groupId>
    <artifactId>klib</artifactId>
    <version>[0.1.0,)</version>
  </dependency>
</dependencies>

Changelog

This is the changelog since the last major change.
Version 0.2.0 was the last major change that broke everything due to a package name change.

## 3.1.0 - 13.06.2019

### Added
- `smartMerge` extension to MutableMap (With value type converter)
- `fullMerge` extension to MutableMap (With value type converter)
- `mergeArrays` extension to MutableMap (With value type converter)
- `toListWithConvert` extension to List
- `toListWithConvert` extension to MutableList
- `fromUrl` extension to File
- `toFile` extension to URL
- `toObjectOfType` extension to URL
- `Http` class
- `Http.DataTypes` Enum Class
- `readText` extension to InputStream
- `fromHex` extension to String
- `fromHexToLong` extension to String
- `toHex` extension to Byte
- `binSearch` extension to IntArray (Using Recursion, its 50% faster)

### Changed
- Moved Library API from Experimental to Stable

## 3.0.0 - 08.06.2019

### IMPORTANT NOTICE
- kLib is now licensed under the OSPL20 (a MPL 2.0 Fork), kLib prior to 3.0 will stay MIT!

### Added
- `smartMerge` extension to MutableMap
- `fullMerge` extension to MutableMap
- `mergeArrays` extension to MutableMap
- `openIfExist` parameter for ZipFile.open
- `reset` extension to File
- `kSock` object class
- `every` extension to Function `() -> Unit`

### Removed
- `version` property of kLibInf (Replaced with semver)
- `versionId` property of kLibInf (Replaced with semver)
- `klibRequire` for versionId (Replaced with semver)
- `klibRequire` for versionId range (Replaced with semver)

### Fixed
- Fixed bug in SemVer parsing crashing when preRelease and buildMetadata was not given

## 2.1.0 - 28.05.2019

### Added
- `new` function to LClass (To be used with `is` and `as` and Interfaces)
- `semver` property of kLibInf is now priority
- `kLibRequire` Top-Level Function gets semver support
- `extract` function to ZipFile
- `unzip` function to ZipFile

### Changed
- Moved `ZipFile` out of Experimental

### Deprecated
- `version` property of kLibInf (Replaced with semver)

### Fixed
- `println` ran in infinite loop

## 2.0.1 - 27.05.2019

### Fixed
- `String.deny` failing on empty strings
- `String.require` not considering empty strings
- `kLibInf.version` having the wrong version number

## 2.0.0 - 27.05.2019

### Added
- `checksum` property for HashResult
- `getBytes` function for HashResult
- `Sha1` Object Class
- `asSha1` extension for String
- `inBoundsOf` extension for Int
- `hashSha256` extension for File
- `hashSha1` extension for File
- `Sha256Checksum` extension for File
- `Sha1Checksum` extension for File
- `asSha1` extension for ByteArray
- `toStrInt` extension for Char
- `semver` property for kLibInf
- `SemVer` Type Class
- `InvalidTypeException` Exception Class

### Removed
- `KonfParseException` Exception Class

### Fixed
- `String.deny` failed on empty string or param; Now only fails on empty param
- `Konfig.parse` crashing on empty lines

## 1.4.0 - 22.05.2019

### Changed
- Extended Experimental Library implementation
  - LClass now supports super class functions
  - LClass now supports direct method invocation
  - LClass now provides a list of LFunction's defined in Host class (and Supers)
  - LFunction now supports one-argument method invocations

### Fixed
- `zipPath` not being used when using `addFiles` on ZipFile

## 1.3.0 - 21.05.2019

### Added
- `Library` Object Class
- `LClass` Type Class
- `LFunction` Type Class
- `loadAsLibraryWithClass` extension for File
- `loadAsLibraryWithClass` extension for String
- `loadAsLibraryWithFunction` extension for File
- `loadAsLibraryWithFunction` extension for String

## 1.2.0 - 17.05.2019

### Added
- `toJson` extension for Any
- `println` Top-Level Function
- `asFile` extension for String
- `ZipFile` Type Class (Experimental API)
- `toFile` extension for InputStream
- `toFileInZipFile` extension for InputStream
- `addToZipFile` extension for File

## 1.1.0 - 16.05.2019

### Added
- `abs` property for Int
- `isTrue` property for Int
- `isFalse` property for Int
- `KonfigParseException` Exception
- `pairOf` Top-Level Function
- `p` Top-Level Function
- `deny` extension for Pair
- `require` extension for Pair
### Deprecated
- `KonfParseException` Exception

## 1.0.0 - 13.05.2019

### Added
- `asInt` extension for Boolean
- `power` extension for Double
- `half` property for Int
- `third` property for Int
- `quarter` property for Int
- `fourth` property for Int
- `tenth` property for Int

## 0.2.2 - 11.05.2019

### Added
- `quicksort` extension for MutableList
- `quicksort` extension for List
- `plusAssign` Function to Queue
- `invoke` Function to Queue
- `startTimedExecution` Function to Queue
- `Konfig` Object Class (Experimental API)

## 0.2.1 - 05.05.2019

### Changed
- Make `Queue` non-experimental

## 0.2.0 - 03.05.2019

## Changed
- Renamed Package `com.atvgstudios.klib` to `klib`

License

kLib is distributed under the OSPL20 License.