How to move a file in Java

In this post we will provide an example of how to move a file in Java. This example uses the standard java libraries so you will not need any external dependencies. How to move a file in Java: The example below uses the Files class which is available from Java 1.7 and above.

  … Continue reading How to move a file in Java

How to rename a file in Java

In this post we will provide an example of how to rename a file in Java. The example uses the standard libraries so no external dependencies will be needed. How to rename a file in Java:

As you can see from the example above its fairly straight forward to rename a file in Java. … Continue reading How to rename a file in Java

How to get file size in Java

In this post we will provide two examples on how to get file size in Java. How to get file size in Java Example 1: Using the Files class

Files.size() will return the size of the file you specified in bytes Example 2: Using the File class

The length() method on the file … Continue reading How to get file size in Java

How to delete a file in Java

In this post we will provide an example on how to delete a file in Java. This example requires no additional libraries we will use the builtin features of Java to delete a file. How to delete a file in Java

The above example shows you need to do the following: Construct the path … Continue reading How to delete a file in Java

How to initialise an array in Java

In this post we will provide a few examples on how to initialise an array in Java. Single dimensional array: Below are some examples on how to initialise a single dimensional array including initialise an array in one line.

Multi dimensional array: Below are some examples on how to initialise a … Continue reading How to initialise an array in Java

Validate a AWS Cognito JWT token

In this post we will provide an example on how to validate a AWS cognito JWT token. Setup: You will need to add the following dependancies to your project:

Validate a AWS cognito JWT token: AWS cognito tokens are signed by a private key, the public key is normally available via the user pool … Continue reading Validate a AWS Cognito JWT token

Java PUT request using Unirest

In this post we will provide some examples on how to make a PUT request using Unirest. Unirest is a lightweight and readable HTTP java client. Setup: You will need to add the following dependency:

Put request using Unirest: Below ¬†are two examples on how to make a REST API call using Unirest, the … Continue reading Java PUT request using Unirest

Java POST request using Unirest

In this post we will provide an example on how to make a POST request using Unirest. Setup: You will need to add the following dependency to your maven project

POST request using Unirest: Below is a simple example on how to send a HTTP Post request.

As you can see the Unirest … Continue reading Java POST request using Unirest

Java GET request using Unirest

In this post we will provide examples of how to make a GET request using Unirest. Unirest is an increasingly popular HTTP client library, with a great API making your code very readable. Setup: You will need to add the following dependency to your maven project

GET request using Unirest: The examples below include … Continue reading Java GET request using Unirest