473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Curious question, why did this happen when I didn't close the output stream...

blazedaces
284 100+
Hey, I was using printwriter and was having problems. It seemed to print onto my file only what seemed like 3/4 of the document. It was supposed to print certain words/"\n" depending on what was read from a fileReader (which I did close).

After I realized my obvious error I closed it when it was supposed to be finished. I still did not expect that to fix my problem. It just seemed odd.

I know that you're always supposed to close any stream/file or anything that is opened or whatever else should be included in that category.

Still, can anyone explain to me, just out of curiosity, what exactly happened?

Thank you for your time and knowledge,

-blazed
Jun 5 '07 #1
7 1195
JosAH
11,448 Expert 8TB
When the JVM halts it is not guaranteed that objects' finalizers are invoked. The
OS takes care that native open file descriptors are closed after their associated
buffers are flushed, but no action is taken (and can't be taken by the OS) when
a Java BufferedWriter (or similar) still has pending data in its non-native buffers
roaming around somewhere.

kind regards,

Jos
Jun 5 '07 #2
blazedaces
284 100+
When the JVM halts it is not guaranteed that objects' finalizers are invoked. The
OS takes care that native open file descriptors are closed after their associated
buffers are flushed, but no action is taken (and can't be taken by the OS) when
a Java BufferedWriter (or similar) still has pending data in its non-native buffers
roaming around somewhere.

kind regards,

Jos
Thank you.

(My message has to be 20 characters long, but I wanted to only say thank you anyways)

-blazed
Jun 5 '07 #3
JosAH
11,448 Expert 8TB
Thank you.

(My message has to be 20 characters long, but I wanted to only say thank you anyways)

-blazed
You could've written 'thank you' twice (but don't forget the dot then ;-)

kind regards,

Jos
Jun 5 '07 #4
blazedaces
284 100+
Is there an obvious, yet I don't see it, way to edit the title of my thread? I didn't realize you can't put tags/italicize inside a title. Maybe I did it wrong, but if so, what did I do wrong and can I edit it so I can fix it?

If not, don't worry about it, it's no big deal.

-blazed
Jun 5 '07 #5
r035198x
13,262 8TB
Is there an obvious, yet I don't see it, way to edit the title of my thread? I didn't realize you can't put tags/italicize inside a title. Maybe I did it wrong, but if so, what did I do wrong and can I edit it so I can fix it?

If not, don't worry about it, it's no big deal.

-blazed
You can only edit your post within 5 minutes of having posted it.
You cannot (I'm not too sure) edit the thread title. If you need to do any of the above just contact a moderator or Admin by PM and they will be able to make the changes for you.
Jun 5 '07 #6
JosAH
11,448 Expert 8TB
Is there an obvious, yet I don't see it, way to edit the title of my thread? I didn't realize you can't put tags/italicize inside a title. Maybe I did it wrong, but if so, what did I do wrong and can I edit it so I can fix it?

If not, don't worry about it, it's no big deal.

-blazed
As far as I know the title text is used as it is, i.e.no special processing there.
(which is a good thing btw, because we don't want layouts etc, screwed up by
humongous pictures in titles etc.)

kind regards,

Jos
Jun 5 '07 #7
blazedaces
284 100+
You can only edit your post within 5 minutes of having posted it.
You cannot (I'm not too sure) edit the thread title. If you need to do any of the above just contact a moderator or Admin by PM and they will be able to make the changes for you.
In this case, it's not important enough. Thank you very much for the information.

As far as I know the title text is used as it is, i.e.no special processing there.
(which is a good thing btw, because we don't want layouts etc, screwed up by
humongous pictures in titles etc.)

kind regards,

Jos
Good point... Thank you as well

-blazed
Jun 5 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
14
by: Daniel Billingsley | last post by:
The example code for Memory shows it being used in a using() block. The documentation for using() says it can only be used on things that implement Disposable. Yet there is no Dispose() method...
17
by: Filip Strugar | last post by:
Considering that the BinaryWriter/BinaryReader object closes the underlaying stream upon being gc collected, is the following code correct, and if it is what is the reason preventing BinaryWriter...
3
by: Debbie Carter | last post by:
Can XML files be easily encrypted?
4
by: Scott F. Brown | last post by:
Greetings all... I was playing around with compressing streams and came across a behavior that I do not understand. I create a stream (input) from the contents of a textbox. That stream is...
7
by: glbdev | last post by:
I have aspnet code (C#) to create a Crystal Report and export to pdf (in browser) without a Crystal Report Viewer. Works great except when the user attempts to save the file from the browser. ...
5
by: neowillis | last post by:
code: #include <iostream> #include <fstream> #include <string> using namespace std; int main() {
8
by: sore eyes | last post by:
Hi I just downloaded the free Watcom compiler and am having a little trouble with File IO http://www.openwatcom.org/index.php/Download I downloaded the following example, commented out the...
8
by: The Natural Philosopher | last post by:
This is so weird. What I am trying to do is to upload files and stuff them in a mysql database. Everything works except the file content is zero. using the load_file command from mysql...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.