如何在 Java 中使用 StringReader 读取字符串的末尾,我不知道字符串的长度是多少。
这是我到目前为止已经走了多远:
public static boolean portForward(Device dev, int localPort, int remotePort)
{
boolean success = false;
AdbCommand adbCmd = Adb.formAdbCommand(dev, "forward", "tcp:" + localPort, "tcp:" + remotePort);
StringReader reader = new StringReader(executeAdbCommand(adbCmd));
try
{
if (/*This is what's missing :/ */)
{
success = true;
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "There was an error while retrieving the list of devices.\n" + ex + "\nPlease report this error to the developer/s.", "Error Retrieving Devices", JOptionPane.ERROR_MESSAGE);
} finally {
reader.close();
}
return success;
}