Convert String to InputStream in Java

In this post we will provide an example of how to convert a String to InputStream in Java. Convert String to InputStream in Java The following example uses the standard JDK libraries.

The example above convert the String to an InputStream. This is done using the ByteArrayInputStream which is a subclass of InputStream. The … Continue reading Convert String to InputStream in Java

Spring Boot Hello World Example

In this post we will provide a basic example of how to get started using Spring Boot, with a Spring Boot Hello World Example. Setup: First, create a new maven project with the following content in your pom file.

Replacing the groupId, artifactId and version as needed. You can create the following package structure … Continue reading Spring Boot Hello World Example

Java 8 stream allMatch, noneMatch and anyMatch examples

In this post we will provide three examples on how to use the java 8 stream allMatch, noneMatch and anyMatch methods. Java 8 stream allMatch, noneMatch and anyMatch examples: Stream allMatch() Example: The allMatch() method is used on a stream to determine, if all the values satisfy a certain condition(predicate). The example below, checks to … Continue reading Java 8 stream allMatch, noneMatch and anyMatch examples

Basic HttpClient Configuration Example

In this post we will provide a basic HttpClient configuration example. The example will configure different timeout values along with connection pool management. HttpClient configuration example: The example below configures a HttpClient object. The configuration details is as follows: RequestConfig: This object is an immutable class which encapsulates request configuration items. RequestConfig.setConnectionRequestTimeout(): Timeout in milliseconds … Continue reading Basic HttpClient Configuration Example