inicjalizacja dlugosci tablicy stringow

0

czy da sie zainicjalizowac tablice tString tak zebym nie musial od razu okreslac jej dlugosci?
wiem ze to nie php ale moze da sie tak... bo po co mi nadmiar elementow...

/*
 * live.java
 *
 * Created on 12 styczeń 2008, 02:18
 */
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;

/**
 *
 * @author  bart
 * @version
 */
public class DataTransfer {
    
    private Form tForm;
    private TextBox tBox;
    private String[] tString;
    public String httpAddress = ""; // url where the file is set
    
    String getLine(InputStream is) {
        String line = "";
        
        try {
            byte b[] = new byte[1];
            int end;
            end = is.read(b);
            
            if( end != -1 ) {
                while ((new String(b).equals("\r") == false) && end!=-1) {
                    line += new String(b);
                    end = is.read(b);
                }
            } else if(end == -1) {
                    return "EOF";
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        
        return line;
    }
    
    public TextBox get_TextBox() throws IOException {
        
        if (tForm == null) {
            
            this.tBox = new TextBox("", "", 400,TextField.ANY);
            this.tString = new String[100];
            
            HttpConnection sc = (HttpConnection)Connector.open(this.httpAddress);
            InputStream is = sc.openInputStream();
            
            boolean flag = true;
            String line;
            int a = 0;
            
            while(flag) {
                
                line = this.getLine(is);
                if(line.equals("EOF")) {
                    flag = false;
                    break;
                } else {
                    tBox.insert(line,tBox.size());
                    tString[a++] = line;
                }
            }
            
            is.close();
            sc.close();
        }
        
        return tBox;
    }
    
}
0

Musi być tablica Stringów ?
Może ArrayList<String> lub Vector<String>/
pozdrawiam

1 użytkowników online, w tym zalogowanych: 0, gości: 1