Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 858995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:37:03+00:00 2026-05-15T08:37:03+00:00

On one of my RedHat Linux Servers a couple devices have been setup. /dev/ap

  • 0

On one of my RedHat Linux Servers a couple devices have been setup. /dev/ap and /dev/reuter. They are AP and Reuters news feeds. At the unix command line I can do “cat /dev/ap” and it waits until a message comes down the feed and prints it out to stdout. As soon as there is a pause in the stream cat completes. I tried “more” and got the same results, same with less -f (complete msg, could be luck) and tail -f had no output in an hour.

I know these are streams, but when I try to open a Java BufferReader on new Reader(“/dev/ap”) I get no output. Using the following run method:

public void run() {
    String line = null;
    while(true) {
        try {
            while((line = bsr.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}  

Couple questions:
1. Are some of the unix commands limited to opening streams from files? e.g. tail?
2. What Am I doing wrong on the Java side that I can’t capture the output?
Wrong stream type, wrong wrapper type?
Jim

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:37:03+00:00Added an answer on May 15, 2026 at 8:37 am

    Your approach seems sound, but readLine() is very particular about what constitutes a line of text. You might look at the raw stream:

    cat /dev/ap | hexdump -C
    

    You could also try read(), as seen in this fragment that reads from /dev/zero:

    BufferedReader in = new BufferedReader(new FileReader("/dev/zero"));
    for (int i = 0; i < 10; i++) {
        System.out.print(in.read() + " ");
    }
    System.out.println();
    in.close();
    

    Addendum: For serial I/O, consider RXTX or similar libraries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been given sudo access on one of our development RedHat linux boxes, and
Recently one of our Tomcat servers started having trouble deploying WAR files. We have
i have two programs one in directory /home/redhat/Documents/java1/j1 Demo1.java package j1; public class Demo1
I have a linux server (Red Hat 4) with one serial port connection to
One of the things that has been talked about a few times on the
I have recently been receiving the following error whenever I am asked to supply
I have a simple scenario, where two servers are connected through a gigabit link.
I have a script that appends some rows to a table. One of the
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
We manage a site for a medical charity. They have a number of links

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.