Solved

Read from the com port

Posted on 1998-04-02
2
208 Views
Last Modified: 2010-08-05
I have used the method below to open and write to the com port.
I wonder if anybody can help me write a method which reads from the com port.
Please show some example code though I'm not very skilled in JAVA coding, yet :-)

       public void printCom1(String OutPrint)
       {
         if (OutPrint != "")
         {
            PrintWriter out = null;
            try
            {
               out = new PrintWriter(new BufferedWriter(new FileWriter("Com1")));
            }
            catch ( IOException e)
            {}
            out.print(OutPrint);
            out.flush();
            out.close();
       }
0
Comment
Question by:joy3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:joy3
ID: 1233934
I wonder how this will effect the platform independency.
0
 

Accepted Solution

by:
mparekh earned 100 total points
ID: 1233935
SUN has come out with a new API for Communications.
It is available for download at the Java Developer Connection.
This package has sample code to read/write Communication ports.
This package should solve your problem.

http://developer.javasoft.com
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tomcat startup error 5 160
eclipse buid path vs tomcat lib path 10 46
dao vs facade design patterns 2 65
Setup Eclipse for Andriod development 2 15
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question