Hirdetés

Új hozzászólás Aktív témák

  • Drizzt

    nagyúr

    válasz btraven #11666 üzenetére

    Koszi a peldat!
    Igy egyszerubb valaszolni a kerdesedre.
    [Javadoc] : "Exceptions are thrown for problems with the OutputStream and for classes that should not be serialized. All exceptions are fatal to the OutputStream, which is left in an indeterminate state, and it is up to the caller to ignore or recover the stream state."
    Szoval nincsen kulonosebben specifikalva, hogy mi fog tortenni Exception eseten. Elofordulhat, hogy kulonbozo JVM-eken es kulonbozo javaverziokon is kulonbozokeppen viselkedik, de a leirasaban benne van, hogy az esetleges szemetet a hivonak kell feltakaritani. Szamomra meglepo, hogy igy van. Szoval a catch agban zard a Streameket, majd torold a fajlt, ha van.
    Ha atirod a peldadat "try with resources" alapon, akkor a close-et nem kell sehol meghivnod, mert a ket outputstream autoClosable.

Új hozzászólás Aktív témák