inputstreamreader

Java BufferedReader examples

Java file FAQ: Can you share some examples of the Java BufferedReader class?

When it comes to reading character input streams, the Java BufferedReader class is extremely important, and I'll demonstrate this in several different source code examples.

Java HttpURLConnection (how to open and read a url with Java) alvin October 7, 2009 - 11:05am

On this blog I've shown a variety of ways using Java to open a URL connection, and then read data from that connection, including my "How to open and read from a URL with the Java URL and URLConnection classes" tutorial. In this example I'll show how to open a URL using the Java HttpURLConnection class.

A Java class that writes to and reads from a remote socket

I'm not going to describe this much today, but here's the source code for a Java class I put together from a number of other sources on the internet. In short, this code uses a Java Socket to connect to a port on a remote server, sends a command to that server to be executed, and then reads the output from the command that is executed. As a result, I assume that all information sent is text (nothing binary).

How to read interactive command-line input with Java

Java command-line FAQ: How do I read command line input from a Java application (interactively)?

Solution: As of Java 5 (and newer Java versions), the best way to solve this problem is to use the Java Scanner class. Before showing an example of how to use the Scanner class, here’s a short description of what it does from the Javadoc:

Java Jar file: How to read a file from a Jar file

Java jar file reading FAQ: Can you show me how a Java application can read a file from own of its own Jar files?

Here's an example of some Java code I'm using to read a file (a text file) from a Java Jar file. This is useful any time you pack files and other resources into Jar files to distribute your Java application.

Java - read Jar file example #1

The source code to read a file from a Java Jar file uses the getClass and getResourceAsStream methods:

A Java HTTPS client example

Java HTTPS client FAQ: Can you share some source code for a Java HTTPS client application?

Sure, here's the source code for an example Java HTTPS client program I just used to download the contents of an HTTPS (SSL) URL. I actually found some of this in a newsgroup a while ago, but I can't find the source today to give them credit, so my apologies for that.