networkutils_0_0_4

Network utilities for JVM platform

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

com.github.ushiosan23
Идентификатор

Идентификатор

networkutils
Последняя версия

Последняя версия

0.0.4
Дата

Дата

Тип

Тип

pom.sha512
Описание

Описание

networkutils_0_0_4
Network utilities for JVM platform
Ссылка на сайт

Ссылка на сайт

https://github.com/Ushiosan23/JVM_NetworkUtils
Система контроля версий

Система контроля версий

https://github.com/Ushiosan23/JVM_NetworkUtils

Скачать networkutils

Зависимости

runtime (6)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.10
org.jetbrains.kotlin : kotlin-reflect jar 1.4.10
org.jetbrains.kotlinx : kotlinx-serialization-core-jvm jar 1.0.0
org.jetbrains.kotlinx : kotlinx-serialization-json-jvm jar 1.0.0
org.jetbrains.kotlinx : kotlinx-coroutines-core-jvm jar 1.4.0-M1
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

JVM Network Utils

Utilities used to manage network actions in JVM (Java Virtual Machine).

Feature status

  • ☑️ Complete
  • 🔳 Partial complete
  • 🔲 Incomplete

Features

  • Make Http request
    • ☑️ GET
      • ☑️ Sync
      • ☑️ Async
      • ☑️ Coroutines
    • ☑️ POST
      • ☑️ Sync
      • ☑️ Async
      • ☑️ Coroutines
    • ☑️ PUT
      • ☑️ Sync
      • ☑️ Async
      • ☑️ Coroutines
    • PATCH
      • Sync
      • Async
      • Coroutines
    • ☑️ DELETE
      • ☑️ Sync
      • ☑️ Async
      • ☑️ Coroutines
  • Download resources from server
    • ☑️ Get percentage of download
    • ☑️ Calculate file size
    • ☑️ Real time download status
    • ☑️ Cancel download
    • 🔳 Pause download (Partial)
      • Resume download
  • 🔳 Upload files to server
    • Get percentage of upload
    • Calculate time
    • Real time download status

Problems

It's not possible to upload large files. I'm working to fix this problem. If you know how to upload large files by chunks you can fork this repo and make a pull request.

Any help is good. 👌 😁

Download

You can download jar file from Release section or put in your gradle project the next code:

Groovy DSL

    repositories {
	mavenCentral()
}

dependencies {
	implementation "com.github.ushiosan23:networkutils:0.0.4"
}

Kotlin DSL

    repositories {
	mavenCentral()
}

dependencies {
	implementation("com.github.ushiosan23:networkutils:0.0.4")
}

Maven POM File

    <dependencies>
        <dependency>
            <groupId>com.github.ushiosan23</groupId>
            <artifactId>networkutils</artifactId>
            <version>0.0.4</version>
        </dependency>
    </dependencies>

How to use

Simple http request

  • Java
import com.github.ushiosan23.networkutils.http.HttpRequestAction;

class SimpleHttpRequest {

	HttpRequestAction action = new HttpRequestAction("https://api.github.com/users/Ushiosan23");

	// Create asynchronous request
	public void makeSyncRequest() throws Exception {
		System.out.println(action.get().body());
	}

	// Create asynchronous request
	public void makeAsyncRequest() {
		// Action always return the same action
		action.getAsync(action -> {
			System.out.println(action.body());
			return action;
		});
	}

	public static void main(String[] args) throws Exception {
		SimpleHttpRequest request = new SimpleHttpRequest();
		request.makeAsyncRequest();
		request.makeSyncRequest();

		Thread.sleep(5000);
	}
}
  • Kotlin
import com.github.ushiosan23.networkutils.http.HttpRequestAction


fun main() {
	val request = HttpRequestAction("https://api.github.com/users/Ushiosan23")

	// Asynchronous request
	request.getAsync { action ->
		println(action.body())
		return@getAsync action
	}

	// Synchronous request
	println(request.get().body())
	Thread.sleep(5000)
}
  • Kotlin Coroutines
import com.github.ushiosan23.networkutils.http.HttpRequestAction
import com.github.ushiosan23.networkutils.http.getAsyncC

suspend fun main() {
	val request = HttpRequestAction("https://api.github.com/users/Ushiosan23")

	// Asynchronous request with coroutines
	println(request.getAsyncC().body())

	// Synchronous request
	println(request.get().body())
}

Версии библиотеки

Версия
0.0.4
0.0.3
0.0.2
0.0.1