Re: OT: java question: CharSequence from file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried to use that fragment (after realizing that parallel reading
won't work because of length() function in CharSequence), but this is
_extremely_ slow for larger (>100k) files. Any ideas why?

		StringBuffer inputSequence = new StringBuffer();
		Charset charset = Charset.defaultCharset();
		ByteBuffer byteBuffer = ByteBuffer.allocateDirect(8192);
		
		while (channel.read(byteBuffer) != -1) {
			byteBuffer.flip();
			CharBuffer charBuffer = charset.decode(byteBuffer);
			inputSequence.append(charBuffer);
			byteBuffer.clear();
		}

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

--
fedora-devel-java-list mailing list
fedora-devel-java-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-java-list

[Index of Archives]     [Red Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux