filestream

How to read large files (a single continuous string) in Java?

若如初见. 提交于 2020-03-04 05:05:35
问题 I am trying to read a very large file (~2GB). Content is a continuous string with sentences (I would like to split them based on a '.'). No matter how I try, I end up with an Outofmemoryerror. BufferedReader in = new BufferedReader(new FileReader("a.txt")); String read = null; int i = 0; while((read = in.readLine())!=null) { String[] splitted = read.split("\\."); for (String part: splitted) { i+=1; users.add(new User(i,part)); repository.saveAll(users); } } also, inputStream = new

Asynchronous operations performance

让人想犯罪 __ 提交于 2020-02-14 02:25:27
问题 One of the features of asynchronous programming in .NET is saving threads during long running operation execution. The FileStream class can be setup to allow asynchronous operations, that allows running (e.g.) a copy operation without virtually using any threads. To my surprise, I found that running asynchronous stream copy performs not only slower, but also uses more processing power than synchronous stream copy equivalent. Is there any benchmark tests were done to compare a synchronous vs

file stream vs local save in sql server?

久未见 提交于 2020-02-11 06:04:00
问题 my application play videos files after that user they are registered .(files are larger than 100 MB ) . Is it better to do I store them on the hard drive and Keep file path in database ? Or do I store in database as File Stream Type ? When data is stored in the database, are more secure against manipulation vs with stored in hard ? How to provide data security against manipulation ? Thanks . 回答1: There's a really good paper by Microsoft Research called To Blob or Not To Blob. Their conclusion

file stream vs local save in sql server?

别来无恙 提交于 2020-02-11 06:02:12
问题 my application play videos files after that user they are registered .(files are larger than 100 MB ) . Is it better to do I store them on the hard drive and Keep file path in database ? Or do I store in database as File Stream Type ? When data is stored in the database, are more secure against manipulation vs with stored in hard ? How to provide data security against manipulation ? Thanks . 回答1: There's a really good paper by Microsoft Research called To Blob or Not To Blob. Their conclusion

file stream vs local save in sql server?

一曲冷凌霜 提交于 2020-02-11 06:02:11
问题 my application play videos files after that user they are registered .(files are larger than 100 MB ) . Is it better to do I store them on the hard drive and Keep file path in database ? Or do I store in database as File Stream Type ? When data is stored in the database, are more secure against manipulation vs with stored in hard ? How to provide data security against manipulation ? Thanks . 回答1: There's a really good paper by Microsoft Research called To Blob or Not To Blob. Their conclusion

ASP.NET Core streaming - write chunks to a request

自古美人都是妖i 提交于 2020-02-04 20:39:47
问题 This is updated question, there used to be a bug in my code I would like to be able to send chunks of data over to the client. Anything will be appreciated. Is there a way to provide to asp.net core more control to how it streams the data. I am worried how the below code scales. Could someone please advise how to go streaming data through a web api in asp.net core? The answer that was provided and the code below works. I am not sure how it scales though? Is it possible to retrieve chunks of

VB - How do I read and write a binary file?

谁都会走 提交于 2020-01-31 05:29:06
问题 How do I read a raw byte array from any file... Dim bytes() as Byte ..and then write that byte array back into a new file? I need it as a byte array to do some processing in between. I'm currently using: To read Dim fInfo As New FileInfo(dataPath) Dim numBytes As Long = fInfo.Length Dim fsAs New FileStream(dataPath, FileMode.Open, FileAccess.Read) Dim br As New BinaryReader(fs) Dim bytes As Byte() = br.ReadBytes(CInt(numBytes)) br.Close() fs.Close() To write Dim fs As System.IO.FileStream fs

How to stream an mp3 file from a URL without using much RAM?

拜拜、爱过 提交于 2020-01-25 21:51:13
问题 I have a method to stream mp3 from url sources. In this method, the file begins downloading and at the same time the downloaded bytes are stored in a MemoryStream. But I realized that this method is not good. Because the RAM usage is approximately 50 mb when the mp3 file is being played. So I want to make it without storing in MemoryStream. I tried storing the downloaded bytes in a temporary file, but it didn't worked. How to fix it to work with FileStream? It works good using MemoryStream:

Difficulty reading large file into byte array

邮差的信 提交于 2020-01-25 12:55:28
问题 I have a very large BMP file that I have to read in all at once because I need to reverse the bytes when writing it to a temp file. This BMP is 1.28GB, and I'm getting the "Out of memory" error. I can't read it completely (using ReadAllBytes) or using a buffer into a binary array because I can't initialize an array of that size. I also can't read it into a List (which I could then Reverse()) using a buffer because halfway through it runs out of memory. So basically the question is, how do I

Binary Formatter, Set Position to Deserialize Particular Object

自作多情 提交于 2020-01-25 08:40:26
问题 I want to ask about serialize/deserialize object with binary formatter. well i'm trying to deserialize object in FileStream that contain many objects that has been serialized one by one. The size of an object is too big to be saved in process memmory that's why i don't pack all of objects in one such as: List because they are too big in process memory So i serialize as much as needed in many times. with this way it won't take many process memmory because i just process one object alternately