Solved

VB equivalent of Java

Posted on 2013-05-14
3
342 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
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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now