Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

what is sun.net

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
there is a java.net.HttpURLConnection; we all know what it is doing
but what is sun.net.www.protocol.http.HttpURLConnection;

When I import it sun.net.www.protocol.http,
netBeans said importing from forbidden package, what is forbidden package term mean, (I KNOW what is forbidden in English mean. )

What is this package, it gives me hard times,
when you try to cast HttpInputStream to BufferedInputStream I have


Although HttpInputStream is BufferedInputStream according to
http://nitric.com/jnp/javadoc/alphabetically/HttpInputStream.html

I think it is the same BufferedInputStream but with different class signature (I mean the classes consist of different things), if you look into that link BufferedInputStream contains a method ensureOpen(), however our
BufferedInputStream is not containing anything like that not even protected or private method (I check that).

What is that, I mean really??

Thanks
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off: any package starting with sun.* is an implementation detail of Sun's JVM. They're not intended to be used directly, although you'll deal indirectly with many of them -- either behind the scenes, or as implementations of public interfaces. In general, the names mean nothing. Just because a class is named X does not necessarily mean it's related to any Java API class named X. The best policy is simply to ignore those classes, and don't try to work directly with them.

Second, that web site you point to gives Javadoc for the source code included with a rather old book. The HttpInputStream documented there is not any class that ever shipped with any JDK -- it's just on the CD that comes with that ten-year-old book! They weren't written by Sun and aren't official in any way. It's very unlikely that you have these classes in your posession, and they're definitely unrelated to the sun.net class you're fiddling with.

Finally, there is no public class named HttpInputStream in the JDK API, and there never has been! Seems like you've gotten yourself confused by Googling around. There are a lot of classes with that name mentioned on the 'Net, but all of them are part of third-party products.
 
Costa Lamona
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good advice about ignore that classes, all that missing around because I trusted a doc just because it is on Google!! and it it did not even tell me the package name. (I should sleep more)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic