Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38277
| From | Daniele Futtorovic <da.futt.news@laposte.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: how do you block the GUI repaints? |
| Date | 2018-05-23 15:58 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <pe3s4h$b7i$1@dont-email.me> (permalink) |
| References | (2 earlier) <6762ff5e-8846-4ea7-be57-7518f2d7ff42@googlegroups.com> <pe1vmo$trt$1@dont-email.me> <a663fea4-e31f-4ec3-952d-ff24c2ba3180@googlegroups.com> <pe2jq7$ah5$1@dont-email.me> <bdb5f760-afe9-474b-ac32-d846e0300b13@googlegroups.com> |
On 2018-05-23 14:54, Eric Douglas wrote: > On Tuesday, May 22, 2018 at 10:31:46 PM UTC-4, Daniele Futtorovic wrote: >> Yes, seriously, it would. Have a look at the Javadoc >> (<https://docs.oracle.com/javase/9/docs/api/java/io/RandomAccessFile.html>), >> at the class definition, and search for usage examples if that's not enough. >> >> Of course, that class will only come in handy if and when you give up on >> the absurd notion of loading multi-gig files into RAM just in order to >> show a couple lines of it. But then it most likely /will/ come in >> handy... unless you have variable-length character encodings in it, in >> which case you'd probably have to index the file before. But still. >> > > That seems to work with the same code I mentioned, just putting this class in place of FileInputStream. Using the RandomAccessFile will allow you, for instance, to display just the last page of the file without reading through all the previous data (which would cause a delay). > I'm not sure what you mean with the variable-length character encodings, I mean that if you have a fixed-length character encoding (say, ASCII or UTF-16), you can compute the position of character N in the file (in case of UTF-16, it would be at byte position N*2). If you have variable-length encoding, you cannot do that. You would have for instance to precompute the byte position of each line by doing a pass on the whole file first; only after that could you page through it (i.e., display line N to N+50). > but on a related note how do I display characters in JTextArea? I tried reading a little PDF with this logic into a byte[] array, passing that into a String constructor, passing that into the insert method and I get a lot of squares. PDF is a binary file, not a text file. Everything I mentioned previously was under the assumption that you were working with text files. If you want to display a PDF, you'll likely be better off using a third-party library (not sure those even exist for Java, but they may). -- DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 10:59 -0700
Re: how do you block the GUI repaints? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-05-22 13:22 -0500
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:00 -0700
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 16:29 -0400
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:51 -0700
Re: how do you block the GUI repaints? Martin Gregorie <martin@mydomain.invalid> - 2018-05-22 21:41 +0000
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 18:03 -0400
Re: how do you block the GUI repaints? Andreas Leitgeb <avl@logic.at> - 2018-05-22 22:22 +0000
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:55 -0700
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-23 11:06 -0400
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 08:19 -0700
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 14:43 -0400
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:20 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-22 22:47 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:58 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 04:30 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 05:54 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 15:58 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:26 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 16:30 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:48 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 18:46 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 10:51 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 22:35 +0200
csiph-web