?
Solved

VB equivalent of Java

Posted on 2013-05-14
3
Medium Priority
?
397 Views
Last Modified: 2013-05-15
What is the VB Equivalent of the following Java code?

	public static final String urlBase = "/bobl/bobl";
	public static final String ENCODING = "ISO-8859-1";
	public static final String DELIMITER = "\r\n";
	protected URL url;
	private InputStream inputStream;
	protected OutputStream outputStream;
	protected Socket socket;
	protected BufferedReader reader;
	private boolean bProcessedHeaders;

Open in new window

0
Comment
Question by:lrbrister
[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
3 Comments
 
LVL 19

Expert Comment

by:Ken Butters
ID: 39166163
This is as close as I can get.... I don't believe there is an exact "translation".

Module Module1
    Const urlbase As String = "/bobl/bobl"
    Const ENCODING As String = "ISO-8859-1"
    Const DELIMITER As String = "\r\n"
    Friend URL As Uri
    Friend outputStream As System.IO.StreamWriter
    Friend socket As System.Net.Sockets.Socket
    Friend reader As IO.BufferedStream

    Sub Main()

        Dim inputStream As System.IO.StreamReader
        Dim bProcessedHeaders As Boolean


    End Sub

End Module

Open in new window


Note: I believe the bufferedReader class would need to be instantiated with a StreamReader Class or something similar in order to be used in a similar fashion as a "bufferedReader".
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 39168718
Friend is not the same as protected. It makes the member visible in the project and does not limit it to derived classes. You should use Protected in VB also.

Also, the private variables do not have to be moved inside of a Sub and declared with Dim. Doing so, they will be visile only inside of the Sub. If you want them to be private to the class, you should leave them at the class level and declare them with Private.

	Public Const urlBase As String = "/bobl/bobl"
	Public Const ENCODING As String = "ISO-8859-1"
	Public Const DELIMITER As String = "\r\n"
	Protected url As Uri
	Private inputStream As IO.StreamReader
	Protected outputStream As IO.StreamWriter
	Protected socket As Net.Sockets.Socket
	Protected reader As IO.BufferedStream
	Private bProcessedHeaders As Boolean

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 39168952
Perfect.  Thanks
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

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.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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