Public Type (VB) for Java

2

I have a project that runs in vb and I have to move to Java, in a certain part I have the structure declarations. 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 them directly because I have to process the data, but I think creating an object for each structure is very cumbersome.

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
    
asked by anonymous 09.03.2017 / 18:46

1 answer

1

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

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 internally uses BufferedReader to ensure buffered reading. If you're already familiar with Java, commons-io already has a multitude of utilitarian methods that you'll probably would do that internally use BufferedReader.

    
09.03.2017 / 22:06