Public Type (VB) for Java

Asked

Viewed 81 times

2

I have a project that runs on Vb and I have to move on to Java, in part I have the structure statements. My question is: What is the best way to do this in Java without loss of performance?

The files I have to read are large and will be saved in SQL, I can not send directly, because I have to treat the data, but I think creating an object for each structure is very heavy.

Example:

Public Type defItemVendidoComp
   data                        As Date
   Hora                        As String * 8
   NumeroPDV                   As Integer
   TipoTransacao               As Byte
   Sequencial                  As Long
   NumeroCupom                 As Long
   Operador                    As String * 6
   CodigoAutomacao             As Double
   DigitoAutomacao             As Byte
   CodigoInterno               As Double
   DigitoInterno               As Byte    
   Peso                        As Single
   PesoMin                     As Single
   PesoMax                     As Single
   Tolerancia                  As Single 
End Type

1 answer

1


The most "next" to VB type will be java classes (which is the same thing as classes in VB). Something still close to Type would be you create a class with public attributes, but still you would have to instantiate it, e.g.:

public class MeuType {
    public Date data;
    public String hora;
    public Integer NumeroPDV;
    ...
}

MeuType meuType = new MeuType();
meuType.data = new Date();
meuType.hora = "11:00:00";
meuType.NumeroPDV = 3;

To read large files, always use any class that uses Bufferedreader internally to ensure buferized reading. If you are already familiar with Java, the lib with him already has a plethora of utility methods that you would probably make using internally Bufferedreader.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.