Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Need library for ANSI terminal output.

Reply
Thread Tools

Need library for ANSI terminal output.

 
 
Michel Pelletier
Guest
Posts: n/a
 
      12-04-2003
Hello,

We need to write text-based (no GUI) Java applications that output to
ANSI terminals across a network, using telnet. Anybody know of a
library similar to AWT or SWING that offers window management, edit
controls and the like, for text-based applications?

Many thanks,

Michel Pelletier

 
Reply With Quote
 
 
 
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      12-04-2003
Michel Pelletier <> writes:
> We need to write text-based (no GUI) Java applications that output to
> ANSI terminals across a network, using telnet. Anybody know of a
> library similar to AWT or SWING that offers window management, edit
> controls and the like, for text-based applications?


There is no pure Java library at all for terminal I/O (one can't do the
necessary line control for terminals via the Reader/Writer/Stream
APIs).

There are some low-level libraries which e.g. wrap the Unix curses
API. Google for jcurses (several libs use this name) or javacurses.
One of these j*curses library (sorry, forgot whiche name), is suppossed
to also offer some higher-level "widgets". And there is charva, which
claims to be a drop-in replacement for AWT.

/Thomas
 
Reply With Quote
 
 
 
 
Brad BARCLAY
Guest
Posts: n/a
 
      12-04-2003
Thomas Weidenfeller wrote:

> There is no pure Java library at all for terminal I/O (one can't do the
> necessary line control for terminals via the Reader/Writer/Stream
> APIs).


If you're writing to an ANSI (or VT52/VT100/VT220/whatever) terminal
you should be able to do this by writing the correct line-control codes
to System.out. You'd have to put together the line control codes
yourself, and embed them into your output.

Mind you, I don't know of any library that currently implements this.

Brad BARCLAY

--
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project: http://www.jsyncmanager.org

 
Reply With Quote
 
Jeffrey Palm
Guest
Posts: n/a
 
      12-04-2003
Michel Pelletier wrote:

> Hello,
>
> We need to write text-based (no GUI) Java applications that output to
> ANSI terminals across a network, using telnet. Anybody know of a
> library similar to AWT or SWING that offers window management, edit
> controls and the like, for text-based applications?
>
> Many thanks,
>
> Michel Pelletier
>


Try TUI:

http://www.bmsi.com/tuipeer/

Jeff

--
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm

 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      12-04-2003
Brad BARCLAY <> writes:
> If you're writing to an ANSI (or VT52/VT100/VT220/whatever) terminal
> you should be able to do this by writing the correct line-control codes
> to System.out. You'd have to put together the line control codes
> yourself, and embed them into your output.


It is not the terminal control which is the problem here. It is
controlling the communication line (if you still have a physical line
running to that one terminal), e.g. setting it to 9600 baud, 7bit, odd
parity, two stop bits, and controlling your OS', e.g. setting a
terminal driver to not map NL to CR (or to map it), or getting fill
characters over the line if you have delays. Or, to make sure
System.in/out don't buffer.

> Mind you, I don't know of any library that currently implements this.


A long time ago I started writing a pure Java library for terminal I/O
(using the old termcap format for terminal capability descriptions),
but gave up due to the lack of control one has over System.out, or any
other Reader/Writer/Stream. There was, e.g. no way to guarantee the
delays some real terminals need after they e.g. get a backspace or CR.
There was no way to ensure System.in/out are unbuffered, etc.

I am convinced that one needs JNI, or a library using JNI, to do any
kind of useful non trivial terminal I/O in Java.

/Thomas
 
Reply With Quote
 
Roald Ribe
Guest
Posts: n/a
 
      12-04-2003

"Thomas Weidenfeller" <> wrote in message
news:bqnjje$m22$...
> Brad BARCLAY <> writes:
> > If you're writing to an ANSI (or VT52/VT100/VT220/whatever) terminal
> > you should be able to do this by writing the correct line-control codes
> > to System.out. You'd have to put together the line control codes
> > yourself, and embed them into your output.

>
> It is not the terminal control which is the problem here. It is
> controlling the communication line (if you still have a physical line
> running to that one terminal), e.g. setting it to 9600 baud, 7bit, odd
> parity, two stop bits, and controlling your OS', e.g. setting a
> terminal driver to not map NL to CR (or to map it), or getting fill
> characters over the line if you have delays. Or, to make sure
> System.in/out don't buffer.
>
> > Mind you, I don't know of any library that currently implements this.

>
> A long time ago I started writing a pure Java library for terminal I/O
> (using the old termcap format for terminal capability descriptions),
> but gave up due to the lack of control one has over System.out, or any
> other Reader/Writer/Stream. There was, e.g. no way to guarantee the
> delays some real terminals need after they e.g. get a backspace or CR.
> There was no way to ensure System.in/out are unbuffered, etc.
>
> I am convinced that one needs JNI, or a library using JNI, to do any
> kind of useful non trivial terminal I/O in Java.


The original poster asked about telnet. No serial port involved.

I am interested to know if you used the optional javax.comm pack
http://java.sun.com/products/javacomm/ for your experiments?
I would be surprised if the wanted functionality you describe
above is not possible with it. But since I have never tested it,
it could be correct that it is not of course.

Roald


 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      12-05-2003
"Roald Ribe" <> writes:
> The original poster asked about telnet. No serial port involved.


Yes, but similar problems. E.g. one needs to make sure telnet is
running in character-by-character mode, and that the bunch of control
characters telnet usually interprets are passed through transparently.
I didn't see a way to control this if all one has is a
Reader/Writer/Stream.

> I am interested to know if you used the optional javax.comm pack
> http://java.sun.com/products/javacomm/ for your experiments?


I know about it, but it wasn't going to fix my primary problem. What is
a terminal library good for that can write to the serial lines only,
but not to the system console?


/Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pre-ansi to ansi c++ conversion? Frank Iannarilli C++ 2 07-21-2009 11:05 PM
emulating an ANSI terminal ? Une Bévue Ruby 0 08-18-2008 11:39 AM
Are there statistics packages in ANSI C and/or ANSI C++? lbrtchx@gmail.com C Programming 11 04-28-2008 03:00 AM
Are there statistics packages in ANSI C and/or ANSI C++? lbrtchx@gmail.com C++ 1 04-24-2008 06:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57