缓冲读卡器无法读取我的Double

时间:2015-09-01 16:54:18

标签: java bufferedreader

ServerSocket serverSocket;
PrintStream streamToClient;
BufferedReader streamFromClient;
Socket fromClient;
static int count = 0;
Thread thread;

InputStreamReader((fromClient.getInputStream())));
streamToClient = new PrintStream(fromClient.getOutputStream());

double strx = streamFromClient.readDouble();
System.out.println("Radius " + strx);

double area = strx * strx;
streamToClient.println("Luas " + area);

我的代码错误

double strx = streamFromClient.readDouble();

任何人都可以帮我在Buffered Reader中阅读“Double”吗?

1 个答案:

答案 0 :(得分:0)

/// <summary>
        /// Proxy for the function SqlServer.REDUCE
        /// </summary>
        [EdmFunction("SqlServer", "REDUCE")]
        public static System.Data.Spatial.DbGeography Reduce(System.Data.Spatial.DbGeography geographyValue, System.Double? tolerance)
        {
            throw EntityUtil.NotSupported(System.Data.Entity.Strings.ELinq_EdmFunctionDirectCall);
        }

无效。 double strx = streamFromClient.readDouble(); 没有BufferedReader方法。

这就是你想要的:

readDouble

警惕可能被String line = streamFromClient.readLine(); double strx = Double.parseDouble(line); 抛出的NumberFormatException,如果您需要处理,则由您决定。