bufferedstream

How to find a specific value after a specific word in Java?

血红的双手。 提交于 2020-01-06 19:40:32
问题 I got a text from a BufferedReader and I need to get a specific value in a specific string. This is the text: aimtolerance = 1024; model = Araarrow; name = Bow and Arrows; range = 450; reloadtime = 3; soundhitclass = arrow; type = Ballistic; waterexplosionclass = small water explosion; weaponvelocity = 750; default = 213; fort = 0.25; factory = 0.25; stalwart = 0.25; mechanical = 0.5; naval = 0.5; I need to get the exact number between default = and ; Which is "213" 回答1: Something like this..

Why would BufferedStream.Write throw “This stream does not support seek operations”?

人走茶凉 提交于 2020-01-01 09:10:52
问题 This one puzzles me. I get an error about seek when I'm not even calling it? I have code that looks something like this: // send 42 uint value = 42; byte[] msg = BitConverter.GetBytes(value); stream.Write(msg, 0, sizeof(uint)); and I get this exception: System.NotSupportedException was unhandled Message="This stream does not support seek operations." Source="System" StackTrace: at System.Net.Sockets.NetworkStream.Seek(Int64 offset, SeekOrigin origin) at System.IO.BufferedStream.FlushRead() at

C# - StreamReader.ReadLine does not work properly!

。_饼干妹妹 提交于 2019-11-28 09:14:12
Simply I have been trying to implement what BufferedStreamReader does in Java. I have a socket stream open and just want to read it in a line-oriented fashion - line by line. I have the following server-code. while (continueProcess) { try { StreamReader reader = new StreamReader(Socket.GetStream(), Encoding.UTF8); string command = reader.ReadLine(); if (command == null) break; OnClientExecute(command); } catch (Exception e) { Console.WriteLine(e.ToString()); } } And the following client-code: TcpClient tcpClient = new TcpClient(); try { tcpClient.Connect("localhost", serverPort); StreamWriter

C# - StreamReader.ReadLine does not work properly!

梦想与她 提交于 2019-11-27 02:52:10
问题 Simply I have been trying to implement what BufferedStreamReader does in Java. I have a socket stream open and just want to read it in a line-oriented fashion - line by line. I have the following server-code. while (continueProcess) { try { StreamReader reader = new StreamReader(Socket.GetStream(), Encoding.UTF8); string command = reader.ReadLine(); if (command == null) break; OnClientExecute(command); } catch (Exception e) { Console.WriteLine(e.ToString()); } } And the following client-code: