comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* help needed loading a jar file and dll file - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58212d9d8355eb16
* opaque - Bedeutung ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34ebf17b0b59b7d8
* Rectangle links to other SVG-Document/Webpage - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90f347728867f633
* Retrieving Stored Procedure Returns - 3 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f242177026be66a
* Strange problem with JDOM, Xerces and XML Schemas - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f772ecb11366c88c
* Calling Overridden Methods without super - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b323ca46ffc0fc37
* Passing Large Size Data over Network - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3be58fc6ae618b13
* java media framework setup problem - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c988a1917b42321a
* excuse me,why i cannot read the complete HTML file...thank you - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f545235913c50e05
* LINUX: Swing creates - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fe177e70bb39950
* TreeCellRenderer does not work? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74265422bb68a88d
* abstract interfaces - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3c9900fa9970d77f
* Why this method behaves differently? - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f14afd9d997d1896
* Sockets Question - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1c2e350dae9e3147
* Overiding protected methods - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efccff5e5289e8d2
  
==========================================================================
TOPIC: help needed loading a jar file and dll file
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58212d9d8355eb16
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:20 am
From: [EMAIL PROTECTED] (Barry) 

Hello,

I hope somebody can help me with the following problem.

My application requires a jar file be loaded dynamically at runtime,
which I do using a URLClassLoader.  However, the classes within the
jar are dependent on a dll also being loaded.  This I cannot do.  An
UnsatisfiedLinkError is reported when classes obtained from the jar
calls methods found in the aforementioned dll.  For example,

java.lang.UnsatisfiedLinkError: getMSRresults_SEC_PARAMETERS at 
com.science.parser.ParserJNI.getMSResults_SEC_PARAMETERS(Native
Method) at
com.science.parser.MSResults.<clinit>(MSResults.java:230) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at
java.lang.reflect.Constructor.newInstance(Constructor.java:274) at
com.micro.search.SearchResults.getResults(SearchResults.java:47)

I have tried loading the dll file using the System.load and
System.loadLibrary methods but to no avail.  No exception is thrown in
either case.  To add insult to injury, if I add the jar file to the
classpath everything works (unfortunately, for licensing reasons, I am
unable to add the jar file to the class path - otherwise I would be
laughing and this post would be redundant).

Any help you can give me will be much appreciated.  Thank you.




==========================================================================
TOPIC: opaque - Bedeutung ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34ebf17b0b59b7d8
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:20 am
From: Rene <[EMAIL PROTECTED]> 

"Martin Meier" <[EMAIL PROTECTED]> wrote:
> Hallo,
>
> kann mir jemand verraten was genau "opaque" meint ?
> Man kann zum Beispiel unter einem Frame die Methode setOpaque() nutzen.
> Werde aus dieser Komponente nicht richtig schlau.

Durchlässigkeit. Also ob Du durchsiehst (transparenz) oder nicht. Ausserdem
solltest Du in comp.lang.* grundsätzlich englisch schreiben...

[OP asked what opaque is]

CU

René

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB




==========================================================================
TOPIC: Rectangle links to other SVG-Document/Webpage
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90f347728867f633
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:28 am
From: [EMAIL PROTECTED] (Gemmel) 

Hi,

im using batik to draw several rectangles via graphics2D.

now i would like to add a link to another html or svg document to the
rectangle. if the user clicks on the rectangle, the other document
should appear.

how can this be done using batik?

thanks!




==========================================================================
TOPIC: Retrieving Stored Procedure Returns
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f242177026be66a
==========================================================================

== 1 of 3 ==
Date:   Fri,   Sep 10 2004 8:29 am
From: "Xeth  Waxman" <[EMAIL PROTECTED]> 


Bryce wrote:
>
> should this be:
> cs = con.prepareCall("{? = call spGetNextBatch(?,?,?,?,?,?,?,?,?)}");
>
> the name spGetNextBatch makes the think there's an actual return
value
> with this stored procedure...
>

It's certainly worth a try; I'll play with it and let you know.  Thank
you!




== 2 of 3 ==
Date:   Fri,   Sep 10 2004 8:42 am
From: "Xeth  Waxman" <[EMAIL PROTECTED]> 


>
> should this be:
> cs = con.prepareCall("{? = call spGetNextBatch(?,?,?,?,?,?,?,?,?)}");

Thanks again for the help.  It didn't work - I modified the code to the
following:

cs = con.prepareCall("{? = call spGetNextBatch(?,?,?,?,?,?,?,?,?)}");
cs.registerOutParameter(1, Types.INTEGER);
cs.registerOutParameter(8, Types.INTEGER);
cs.registerOutParameter(9, Types.INTEGER);
cs.registerOutParameter(10, Types.INTEGER);
cs.setString(2, "GCC");
cs.setInt(3, 8);
cs.setInt(4, 802);
cs.setString(5, userName);
cs.setString(6, batchComment);
cs.setString(7, todayString);

//everything's set - execute
cs.execute();
while (cs.getMoreResults() == true && cs.getUpdateCount()!= -1) {
//processing stuff
System.out.println("foo");
}

//get our values out
int batchKey = cs.getInt(8);
int nextBatchNo = cs.getInt(9);
int retVal = cs.getInt(10);

Still all three values are uninitied (0).




== 3 of 3 ==
Date:   Fri,   Sep 10 2004 10:30 am
From: "Xeth  Waxman" <[EMAIL PROTECTED]> 

Is it possible that besides the getMoreResults() and getUpdateCount()
methods, I have to call an additional method in order to meet the
"somewhat strange" stored procedure serialization requirement (that is,
values must come out in the same order they were created)?  I tried
adding this snippet after the while loop, but it didn't change
anything:

ResultSet testRS = cs.getResultSet();
try {
while (testRS.next()) {
//something here
System.out.println("foo");
}
} Catch (NullPointerException e) {
  //null or empty RS
}





==========================================================================
TOPIC: Strange problem with JDOM, Xerces and XML Schemas
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f772ecb11366c88c
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:42 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Fri, 10 Sep 2004 16:19:32 +0200, Soeren wrote:

> I have a strange problem with JDOM, Xerces and XML Schemas.

Please do not multi-post, Soeren.
<http://www.physci.org/codes/javafaq.jsp#xpost>

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology




==========================================================================
TOPIC: Calling Overridden Methods without super
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b323ca46ffc0fc37
==========================================================================

== 1 of 3 ==
Date:   Fri,   Sep 10 2004 8:45 am
From: [EMAIL PROTECTED] (Marco) 

Can I call the overridden version of an object's foo() method 
outside that object's class, without using super? EG:

class MainProgram {
  public static void main(String[] args) {
    Beta b = new Beta();

    // I want to invoke Alpha.foo() but on the Beta instance. 
    // I want to cancel the dynamic binding that makes Beta.foo() 
    // get called instead
    // b.super.foo()        <---- obviously doesn't compile
  }
}

class Alpha {
  public void foo() { System.out.println("inside Alpha.foo()"); }
}

class Beta extends Alpha {
  public void foo() { System.out.println("inside Beta.foo()"); }
}

Is this possible?
Marco



== 2 of 3 ==
Date:   Fri,   Sep 10 2004 8:54 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 10 Sep 2004 08:45:33 -0700, Marco wrote:

>     // I want to invoke Alpha.foo() but on the Beta instance.

Why?  I suggest do you describe
what you want to achieve.

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 3 of 3 ==
Date:   Fri,   Sep 10 2004 9:18 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

Marco wrote:

> Can I call the overridden version of an object's foo() method
> outside that object's class, without using super?

Not directly.  That's to say, there's no way that the Java language can express
that.

You may be able to do it via reflection -- find the instance of Method in the
superclass, and then invoke() that against your subclass object.  That /ought/
to work, I think, although it wasn't very clearly defined last time I looked,
and it's not something I've tested myself.  (And is such an odd case that I'd
be wary of assuming that it worked on all Java implementations, even if it does
work on some/most.)

Alternatively, you can definitely do it via JNI (I know because I do it).

The chances are, though, that there's a better way to do whatever it is you are
really trying to achieve.

    -- chris







==========================================================================
TOPIC: Passing Large Size Data over Network
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3be58fc6ae618b13
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 8:48 am
From: Paul Lutus <[EMAIL PROTECTED]> 

YU wrote:

> Hello!
> There is one problem which has been causing me much trouble.
> (Perhaps I haven't got enough exp on app development in Java)
> In a network environment, we have to develop a system to transmit
> large size data (several hundred MB). When using RMI, or J2EE, or
> other distributed framework, how can this be done? Thanks!

Your question is too open-ended. What have you tried, and what difficulties
did you encounter?

-- 
Paul Lutus
http://www.arachnoid.com




== 2 of 2 ==
Date:   Fri,   Sep 10 2004 8:54 am
From: kjc <[EMAIL PROTECTED]> 

Paginate the data.

YU wrote:
> Hello!
> There is one problem which has been causing me much trouble.
> (Perhaps I haven't got enough exp on app development in Java)
> In a network environment, we have to develop a system to transmit
> large size data (several hundred MB). When using RMI, or J2EE, or
> other distributed framework, how can this be done? Thanks!
> 
> YU
> 





==========================================================================
TOPIC: java media framework setup problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c988a1917b42321a
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 8:50 am
From: [EMAIL PROTECTED] (handerson) 

I have problem with installation of the java media framework on my
computer(windows xp,java version 1.4.1)

in client variable

CLASSPATH=C:\Program Files\JMF2.1.1e\lib\jmf.jar;C:Program
Files\JMF2.1.1e\lib\sound.jar;.;

PATH=C:\Program Files\JMF2.1.1e\lib

but The diagnostic test on sun's website fails

        JMF Diagnostics:

        Java 1.1 compliant browser.....Maybe
        JMF classes.....Not Found

has anybody an idea?



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 8:57 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 10 Sep 2004 08:50:43 -0700, handerson wrote:

> I have problem with installation of the java media framework ..

Please do not multi-post, handerson.
<http://www.physci.org/codes/javafaq.jsp#xpost>

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology




==========================================================================
TOPIC: excuse me,why i cannot read the complete HTML file...thank you
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f545235913c50e05
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:51 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Vincent Cantin wrote:

>> The cause is that available() call only returns the number of bytes you
> can
>> read before blocking. It does not mean that's the end of the data... it
>> is possible that not all the data have arrived when you call read().
>>
>> Use a while loop, and read until you get a -1 (which indicates end of
>> stream).
> 
> Precision : available() will never return -1.
> The minimum it usually returns is 0.

The prior poster is not suggesting the use of available() at all. He
suggests actually reading characters until -1 is returned, indicating end
of file.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: LINUX: Swing creates
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fe177e70bb39950
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:54 am
From: Paul Lutus <[EMAIL PROTECTED]> 

tom baker wrote:

> Hi there,
> 
> I'm programming an application for touchscreens. Each 'page' on the
> screen is a JFrame. Among other criterions it's IMHO the easiest way
> to go into 'idle'-state  (by using a javax-Timer with 'dispose').
> 
> Each new JFrame (e.g. ttt= new gui_menu_one(); ) creates a new linux
> thread (or process). But after dispose() the thread/process of this
> JFrame is still there.

You need to post your code, not a series of comments where your code would
have been had you posted it.

> Now I worry about that the whole system could 
> slow down or stop after a certain time, because the OS still has to
> provide ressources for these non-active processes/threads.
> 
> What is the cause?  java?

It's definitely your code. The code you didn't post.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: TreeCellRenderer does not work?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74265422bb68a88d
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 8:56 am
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

David wrote:
> Hello,
> I implemented a TreeCellRenderer which should display user objects
> depending on a condition in different colours if they are selected or
> not. This is my implementation:
> 
> public class CategoryTreeCellRenderer extends DefaultTreeCellRenderer
> {
>   private Logger logger =
> Logger.getLogger(CategoryTreeCellRenderer.class);
>   private DocumentContext original;
>   private static Color COL_BKG_CONTAIN_SELECT = Color.RED;
>   private static Color COL_TXT_CONTAIN_SELECT = Color.WHITE;
>   private static Color COL_BKG_CONTAIN_NONSELECT = Color.BLUE;
>   private static Color COL_TXT_CONTAIN_NONSELECT = Color.WHITE;
>   private static Color COL_BKG_ABSENT_SELECT = Color.GREEN;
>   private static Color COL_TXT_ABSENT_SELECT = Color.WHITE;
>   private static Color COL_BKG_ABSENT_NONSELECT = Color.WHITE;
>   private static Color COL_TXT_ABSENT_NONSELECT = Color.BLACK;
> 
>   public CategoryTreeCellRenderer(DocumentContext original) {
>     this.original = original;
>   }
>   
>   public Component getTreeCellRendererComponent(JTree tree, 
>                                                 Object value, 
>                                                 boolean selected, 
>                                                 boolean expanded, 
>                                                 boolean leaf, 
>                                                 int row, 
>                                                 boolean hasFocus) {
>     super.getTreeCellRendererComponent(tree, value, selected,
>                                        expanded, leaf, row,
>                                        hasFocus);
>     DomainModelElement elem = 
>       (DomainModelElement)((DefaultMutableTreeNode)value).getUserObject();
>     if(elem instanceof Category) {
>       Category cat = (Category)elem;
>       logger.debug("original.contains("+cat.getID()+"):"+(original.contains(cat)));
>       if(original.contains(cat)) {
>         setBackgroundSelectionColor(COL_BKG_CONTAIN_SELECT);
>         setTextSelectionColor(COL_TXT_CONTAIN_SELECT);
>         setBackgroundNonSelectionColor(COL_BKG_CONTAIN_NONSELECT);
>         setTextNonSelectionColor(COL_TXT_CONTAIN_NONSELECT);
>       } else {
>         setBackgroundSelectionColor(COL_BKG_ABSENT_SELECT);
>         setTextSelectionColor(COL_TXT_ABSENT_SELECT);
>         setBackgroundNonSelectionColor(COL_BKG_ABSENT_NONSELECT);
>         setTextNonSelectionColor(COL_TXT_ABSENT_NONSELECT);
>       }
>     }
>     invalidate();
>     repaint();
>     return this;
>   }
> }
> 
> The problem is, it works fine until the condition
> 'if(original.contains(cat))' is true for a node. The particular node
> will be shown correctly, i.e. blue background, black text, but the
> following node (for which the condition does not hold) will be white
> text on white background (pretty unhandy, I'd say). Please, can
> anybody help?

First of all no need to call invalidate() or repaint() in your renderer code. 
The actuall validation / painting will be done by the UI code after receiving 
the component (the result of this method call).

To solve your problem, move the super.getTreeCellRendererComponent call to 
*after* customizing the Selectioncolor/nonselectionColor etc. The default 
implementation performs the foreground/background selection based on the state 
during this call, and switching colors after it has already prepared the 
renderer doesn't help.

BK




==========================================================================
TOPIC: abstract interfaces
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3c9900fa9970d77f
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 9:03 am
From: Daniel Bonniot <[EMAIL PROTECTED]> 


Note that "abstract interfaces" is a concept in itself (although it's not 
present in Java): http://c2.com/cgi/wiki?AbstractInterface

Cheers,

Daniel
--
The Nice programming language: http://nice.sf.net




==========================================================================
TOPIC: Why this method behaves differently?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f14afd9d997d1896
==========================================================================

== 1 of 3 ==
Date:   Fri,   Sep 10 2004 9:30 am
From: [EMAIL PROTECTED] (otsarri) 

/**
* The method "addItem()" receives an item from a
* database. The item has several fields like:
* Reference, Categorie, Name.... and so on.
* I have tried the method with Strings objects instead of
* items and it works, when the String is not found
* "indexOItem" evaluates to –1 else evalutes to 0.
* But when adding item objects retreived from the
* database, it does not work, "indexOfItem" always
* evaluates to –1 even when I try to add an object
* that already is in the Vector.
* Any ideas? Many thanks in advance
*/

public void addItem(Product newItem){
        int indexOfItem = items.indexOf(newItem);
        if(indexOfItem == -1){
                items.addElement(newItem);
        }else{
                Producto currentItem = (Product)items.elementAt(indexOfItem);
                //more code....
        }
}



== 2 of 3 ==
Date:   Fri,   Sep 10 2004 9:47 am
From: "VisionSet" <[EMAIL PROTECTED]> 

"otsarri" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> /**
> * The method "addItem()" receives an item from a
> * database. The item has several fields like:
> * Reference, Categorie, Name.... and so on.
> * I have tried the method with Strings objects instead of
> * items and it works, when the String is not found
> * "indexOItem" evaluates to -1 else evalutes to 0.
> * But when adding item objects retreived from the
> * database, it does not work, "indexOfItem" always
> * evaluates to -1 even when I try to add an object
> * that already is in the Vector.
> * Any ideas? Many thanks in advance
> */
>
> public void addItem(Product newItem){
> int indexOfItem = items.indexOf(newItem);
> if(indexOfItem == -1){
> items.addElement(newItem);
> }else{
> Producto currentItem = (Product)items.elementAt(indexOfItem);
> //more code....
> }
> }

you need to override equals and hashcode for Product.
the default behaviour of equals is to do an == comparison.
If you have an item from a database you probably have an item that is not
the same object though you may see it as equal.  == only evaluates true for
references to the SAME object.

--
Mike W





== 3 of 3 ==
Date:   Fri,   Sep 10 2004 10:21 am
From: Chris Smith <[EMAIL PROTECTED]> 

VisionSet wrote:
> you need to override equals and hashcode for Product.
> the default behaviour of equals is to do an == comparison.
> If you have an item from a database you probably have an item that is not
> the same object though you may see it as equal.  == only evaluates true for
> references to the SAME object.

Mike's answer is correct, but perhaps I can make a different suggestion.

If you're dealing with objects from the database, then chances are they 
are not value objects.  In other words, two objects -- even with the 
same values for all the fields -- are not interchangable in your 
application.  For example, perhaps one object is used to capture a 
snapshot of the data's state at a given point in time, while another 
represents its state in your current transaction.  You may intend to 
change one of them later, but not the other.  These things make that 
class a poor choice for overriding equals or hashCode.

If that's the case, then another alternative is to create a simpler 
immutable class to represent the actual identity of that row; notably 
perhaps its primary key, which you might never change.  You could then 
use a Map instead of a List, and your application would not be nearly so 
fragile as it would if you added a mechanical implementation of equals 
and hashCode.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Sockets Question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1c2e350dae9e3147
==========================================================================

== 1 of 4 ==
Date:   Fri,   Sep 10 2004 9:32 am
From: "Ike" <[EMAIL PROTECTED]> 

If I succesfully create a Socket as follows:

            Socket sock = new Socket("192.168.1.55", 1000);

Then, go to send data, and listen in on it as follows:

               BufferedWriter os = new BufferedWriter(new
OutputStreamWriter(sock.getOutputStream()));
               BufferedReader is = new BufferedReader(new
InputStreamReader(sock.getInputStream()));
                try{
                    os.write("D0");
                    os.flush();
                    returnedString =is.readLine();
                    System.out.println(returnedString);
                }catch (java.io.IOException e) {


I get hung up on -->    is.readLine();

I don't understand why the system would simply hang here. Am I missing
something? Am I doing something really stupid here that I am oblivious to?
Thanks, Ike





== 2 of 4 ==
Date:   Fri,   Sep 10 2004 10:10 am
From: "Lee" <[EMAIL PROTECTED]> 

You need a while loop in there:

try{
                    os.write("D0");
                    os.flush();
                    String returnedString = "";
                     while((returnedString =is.readLine())!=null){
                            System.out.println(returnedString);
                    }
     }catch (java.io.IOException e) {


"Ike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If I succesfully create a Socket as follows:
>
>             Socket sock = new Socket("192.168.1.55", 1000);
>
> Then, go to send data, and listen in on it as follows:
>
>                BufferedWriter os = new BufferedWriter(new
> OutputStreamWriter(sock.getOutputStream()));
>                BufferedReader is = new BufferedReader(new
> InputStreamReader(sock.getInputStream()));
>                 try{
>                     os.write("D0");
>                     os.flush();
>                     returnedString =is.readLine();
>                     System.out.println(returnedString);
>                 }catch (java.io.IOException e) {
>
>
> I get hung up on -->    is.readLine();
>
> I don't understand why the system would simply hang here. Am I missing
> something? Am I doing something really stupid here that I am oblivious to?
> Thanks, Ike
>
>





== 3 of 4 ==
Date:   Fri,   Sep 10 2004 10:23 am
From: Sudsy <[EMAIL PROTECTED]> 

Ike wrote:
<snip>
> I get hung up on -->    is.readLine();
> 
> I don't understand why the system would simply hang here. Am I missing
> something? Am I doing something really stupid here that I am oblivious to?
> Thanks, Ike

Possibly the other end isn't sending line-termination character(s).




== 4 of 4 ==
Date:   Fri,   Sep 10 2004 10:26 am
From: Chris Smith <[EMAIL PROTECTED]> 

Ike wrote:
>                BufferedWriter os = new BufferedWriter(new
> OutputStreamWriter(sock.getOutputStream()));
>                BufferedReader is = new BufferedReader(new
> InputStreamReader(sock.getInputStream()));
>                 try{
>                     os.write("D0");
>                     os.flush();
>                     returnedString =is.readLine();
>                     System.out.println(returnedString);
>                 }catch (java.io.IOException e) {
> 
> 
> I get hung up on -->    is.readLine();
> 
> I don't understand why the system would simply hang here. Am I missing
> something? Am I doing something really stupid here that I am oblivious to?

A couple things:

1. You are using the platform's default encoding to talk over a socket.  
By definition, the platform default encoding is intended to be used as a 
default encoding for local text.  It's nearly always a mistake to use it 
for network communication.  Find out what the proper encoding is for 
your network protocol (it's quite likely to be ASCII or ISO 8859-1) and 
specify that by name when you create the InputStreamReader and 
OutputStreamWriter.

2. The reason your code hangs on is.readLine() is probably that it's 
waiting for the server to finish sending a line of text.  If the server 
doesn't send newlines at the end of its text, you'll need to use a 
different method instead.  Alternative, if newlines are used in this 
protocol, then you might need to send one after "D0".  I have trouble 
imagining a protocol where a client would send "D0" and the server would 
immediately respond with something terminated by a newline.  Check your 
assumptions in the documentation for this protocol.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Overiding protected methods
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efccff5e5289e8d2
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 10:22 am
From: "P.Hill" <[EMAIL PROTECTED]> 

Alex Hunsley wrote:

 > Why not just make A.foo() public then? [...]
> 
> Such a change is very trivial - just about the only way you could break 
> A is if you misspell "public" when you write it, which will be an 
> obvious error....

It's probably one of those methods in which the Java docs say: "This method
is intended for use in limited sitautions for example ...., please use the more 
standard foo( ... ) in most other situations"

There is at least one of those "please don't normally call" methods in the 
hibernate documentation; In the on-line manual:
http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#manipulatingdata-creating
Section 9.1 ...
"We generally discourage the use of the two-argument form since ..."

Now I'm not saying the folks at Hibernate could use some hidden subclass form, 
just that there certainly are cases of public methods which are not really 
intended to be called by all. If the OP can figure out how to limit the 
distribution of the inner subclass A2s such they don't circulate to all parts of 
the program this may have an advantage in keeping various subsystems playing the 
"normal" way with A instances.

-Paul






=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

<a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to