[brailleblaster] Re: searching java reference

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Fri, 10 Dec 2010 22:47:59 +0000

Here is a link from the ArchLinux AUR package for the JDK documentation http://www.ms.mff.cuni.cz/~kuceo9am/archlinux/jdk-6u18-docs.zip <http://www.ms.mff.cuni.cz/%7Ekuceo9am/archlinux/jdk-6u18-docs.zip>. I thought it was available on the oracle site as a zip file but I struggled to find it amongst the rest of the stuff so this link will do.


Michael Whapples
On 10/12/10 21:59, qubit wrote:
Hi Mike --
I am new to search javadocs, but I need to find a better way than accessing
that site, as it is doggy slow from where I am.
I indeed have seen some of the verbose descriptions, but not for these
methods.
As for reversing, I am thinking of both the child process and the parent
(brailleblaster) -- what java is providing is a getError that reverses the
childs output to input of the parent process.  That's all well and good.
The other methods however are named
such that I am not sure they are connecting to the right stream, which is
only made clear buried in the docs.  It can probably be surmised, but the
naming is not clear without the docs.

A lot of verbage back and forth that was really not necessary.  It takes a
while to compose questions as well as constructing replies. Sometimes I find
the answer in the process of asking.  Sometimes the docs elude me.
So hopefully this is the last write on my InputStream...*smile*
--le

----- Original Message -----
From: "Michael Whapples"<mwhapples@xxxxxxx>
To:<brailleblaster@xxxxxxxxxxxxx>
Sent: Friday, December 10, 2010 3:28 PM
Subject: [brailleblaster] Re: searching java reference


I did previously ask you to read the full descriptions, does this mean
you have generally been missing the full descriptions in javadocs? When
you see the method name in the list of methods there is a summary
description, to get these full descriptions follow the link of the
method name.

I don't quite get what you mean about them reversing method names. If
they were to reverse the names of all three of those methods, what's the
reverse of error stream? How would that have been changed to match the
convention used on getInputStream and getOutputStream?

Michael Whapples
On 10/12/10 21:09, qubit wrote:
Ok Mike, I see the docs you have quoted, which I hadn't read.  The thing
that annoys me is the inconsistent naming of the methods.  If they are
reversing the names of one method, they ought to do the same for all 3 of
them.
However, indeed this documentation does resolve the problem.
Thanks.
--le



----- Original Message -----
From: "Michael Whapples"<mwhapples@xxxxxxx>
To:<brailleblaster@xxxxxxxxxxxxx>
Sent: Friday, December 10, 2010 1:53 PM
Subject: [brailleblaster] Re: searching java reference


I decided to give the example as I seem to get this fine as a Java
programmer but you still don't seem to be getting what the javadoc is
referring to. I wondered whether it was to do with how Java programmers
go about naming methods.

I will do two things now, give one very short explanation as to what the
method name means as I think this is what is confusing you and then I
will copy the long description of the javadoc which perfectly explains
it to me. What I would then ask if it still seems inconsistent, point
out precisely in that text what is wrong, otherwise there is no more I
can do to help you with this but take over the task and complete it.

Treat methods beginning get as getters, they are getting a java object
contained in the object the method belongs to. So getInputStream is
getting the java object which has data coming into java from the spawned
process, this must be of type InputStream. Likewise getOutputStream gets
the java object which pipes data out of java to the spawned process,
again must be OutputStream.

Now follows is the text from the javadoc, as I said please point out
specifically how this is inconsistent in the following text.

     getOutputStream

public abstract OutputStream getOutputStream()

             Gets the output stream of the subprocess. Output to the
stream is piped into the standard input stream of the
             process represented by this Process object.

             Implementation note: It is a good idea for the output stream
to be buffered.

           Returns:
                   the output stream connected to the normal input of the
subprocess.

__________________________________________________________________________________________________________________

     getInputStream

public abstract InputStream getInputStream()

             Gets the input stream of the subprocess. The stream obtains
data piped from the standard output stream of the
             process represented by this Process object.

             Implementation note: It is a good idea for the input stream
to be buffered.

           Returns:
                   the input stream connected to the normal output of the
subprocess.

           See Also:
                   ProcessBuilder.redirectErrorStream()

__________________________________________________________________________________________________________________

     getErrorStream

public abstract InputStream getErrorStream()

             Gets the error stream of the subprocess. The stream obtains
data piped from the error output stream of the
             process represented by this Process object.

             Implementation note: It is a good idea for the input stream
to be buffered.

           Returns:
                   the input stream connected to the error stream of the
subprocess.

           See Also:
                   ProcessBuilder.redirectErrorStream()

On 10/12/10 18:14, qubit wrote:
Mike, no need for the hose example, as I have said I have programmed this
in
C several times, complete with hooking up pipes.  The question was in the
java docs, which, as I reread right now, do not imply that
getInputStream()
connects to the output stream of the child process.
It is documented inconsistently as the error stream does connect the
stderr
to an input stream in the parent. But the input stream appears to have
input
at both ends of the hose, and the OutputStream appears to have output at
both ends of the hose.  (like a bad case of the flu -- sorry, couldn't
resist...;)
Only the error stream appears to be flowing correctly.
Perhaps there is a processing step I have missed.  Is java's process
control
based on unix's fork() and exec() model?  I see there is a collection of
exec methods.  However, there is not anything documented in the pages I
am
looking at that describe how to identify when one is in the child or
parent
process.  Perhaps hooking up pipes is still necessary.
This code is going together nicely, but I need to get past this one step.
--le

----- Original Message -----
From: "Michael Whapples"<mwhapples@xxxxxxx>
To:<brailleblaster@xxxxxxxxxxxxx>
Sent: Friday, December 10, 2010 6:01 AM
Subject: [brailleblaster] Re: searching java reference


I will explain this again, it reads correct to me:
InputStream getErrorStream: This is the error output from the process
you spawned, it is being read back into your Java code, therefore from
the frame of reference of the Java code data is flowing in.
InputStream getInputStream: This is standard out of the process, so
again the Java code is reading in, data flow is out of the process and
into the Java, so InputStream.
OutputStream getOutputStream: This is connected to standard in of the
process, so Java is sending data out and the process is getting data in.

Reading the human generated description of these methods in the javadoc
makes it clear to me this is what is going on.

I will try and give a different example which may help explain this flow
stuff and the direction. If I consider a water tap with a hose pipe (I
will refer to as the pipe) which has the other end of the hose pipe in a
pool. If you turn on the tap to fill the pool with water you get water
flowing along the pipe. Now answer the question is water flowing in or
out? Hopefully you will say it depends on what is being referred to, the
tap or the pool. Water is flowing out of the tap and into the pool at
the same time. So to the tap the pipe is an output and to the pool the
same pipe is input.

Now let us try and transfer this back to the problem of
java.lang.Process. Let us consider the error pipe (as this will not give
us any naming problem). Instead of water flowing the pipe we have data,
the process is able to be like the tap and output to standard error, our
controlling java application is like the pool and is getting input from
this pipe.

Now if we consider getInputStream, the human part of the javadoc does
say this relates to standard output of the spawned process, this makes
sense if the method is named for the controlling java code. The spawned
process is like the tap in the water example, it outputs to standard
output, data flows through the pipe to the java code which reads this
data  in from the pipe and yes we use InputStreams for that.

I hope now you can work out getOutputStream yourself, it doesn't feel
worth repeating what I have said.

Does the javadoc now make sense to you?

Michael Whapples
On 09/12/10 23:41, qubit wrote:
Sina, the docs say

InputStream getErrorStream();
InputStream getInputStream();
OutputStream getOutputStream();

If I'm the parent process and just spawned this process, then the last 2
return types should be switched as I will be writing to input and
reading
from output.
Note that err and out are treated inconsistently.

Is this a bug? Do I need to do some obscure pipe operations to get the
input
and output flowing correctly? Then why was err handled differently from
out?
You're a java expert, perhaps you can settle this. I am just now getting
ready to compile my code, which should tell me if my types are
mismatched.
I'll be posting to list hopefully soon.
TIA
--le

----- Original Message -----
From: "Sina Bahram"<sbahram@xxxxxxxxx>
To:<brailleblaster@xxxxxxxxxxxxx>
Sent: Thursday, December 09, 2010 5:11 PM
Subject: [brailleblaster] Re: searching java reference


The human part of javadoc can be incorrect, although I find this
doubtful.

However, the actual return type of the methods, as you've discussed, are
not
incorrect. They might not meet expectations, but it is
automatically generated, so I find it next to impossible for this to be
incorrect.

Take care,
Sina
-----Original Message-----
From: brailleblaster-bounce@xxxxxxxxxxxxx
[mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Thursday, December 09, 2010 5:49 PM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] searching java reference

Is there an easyer way to search the java reference pages by class or by
category? I'm having a fun time playing with process and
runtime and streams and the like, but some of the docs are indeed
incorrect,
despite what Mike is saying.
I am looking at the link you sent me about the getInputStream() etc
methods
in class Process.
Perhaps I will go look for a download link, but I don't have much space
on
my hd.

I will post what I have so far shortly, but indeed I know the docs are
wrong, because they are inconsistent.  Compiling will solve
the dilemma.
--le









Other related posts: