0

0 から 9 までの長さの配列を返す API を呼び出しています。今、その配列を取得する方法がわかりません。単純な文字列を取得するために、他のAPIの私のコードは:このコードに従って正常に動作しています。

private String test(String url)
{
    String str = null;
    int c;
    try
    {
    URL hp = new URL(url);  //The String hp1 is passed in URL

    URLConnection hpCon = hp.openConnection();  
    hpCon.setUseCaches(false);
    hpCon.setConnectTimeout(10000);
    System.out.println("*url content for: " + url);
    InputStream input=hpCon.getInputStream();
    StringBuffer sb = new StringBuffer();

    while(((c=input.read())!= -1))
    {
        sb.append((char)c);
    }
    str=sb.toString();
    sb = null;
    //System.out.print(str);

    input.close();
    input = null;
    hpCon = null;
    hp = null;
    }
    catch(Exception e)
    {

    }
    return str;  
}
4

0 に答える 0