0
我的代碼從http連接讀取並將數據放入ByteArrayOutputStream
。從http協議讀取並放入字符串數組(Android/Java)
http數據內容的第一行是更新日期/時間,然後是其他數據。
2012-03-02 03:06:34
text1
text2
text3
我發現這個:從HTTP URL收到
數據舉例
InputStream content = response.getEntity().getContent();
byte[] buffer = new byte[1024];
int numRead = 0;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while((numRead=content.read(buffer))!=-1){
baos.write(buffer, 0, numRead);
}
content.close();
String result = new String(baos.toByteArray());
如何使用的第一行(「2012-03-02 3時06分34秒「)然後其他人排?
我會想使用一個字符串數組,並與
for (int i=1;i<baos.length;i++) {...}
拿到第一排與BAOS [0]和其他人如何可以嗎? 謝謝。 我的英語非常難看:-o
當時正是我需要的,一個簡單的代碼來使用。 非常感謝 – Cuarcuiu 2012-03-03 11:12:30