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
Solved

VB equivalent of Java

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

792 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