Solved

VB equivalent of Java

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
print map entry 34 55
SQL Login 17 40
eclipse apache tomcat admin console 39 46
I need help converting a bitmap to an image in VB.Net 1 14
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

910 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

19 Experts available now in Live!

Get 1:1 Help Now