Page 1 of 1

About Question enthuware.ocpjp.v7.2.1551 :

Posted: Sun Jun 02, 2013 2:31 am
by makopo
Does 1Z0-805 really cover OpenOption or FileChannel?

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Sun Jun 02, 2013 6:16 am
by admin
OpenOptions, Yes. FileChannel, No.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Sat Jun 08, 2013 9:27 pm
by makopo
Thanks.

Let me another question -
enthuware.ocpjp.v7.2.1552 wrote:Which of the following statements are valid usages of StandardOpenOption options that control how the file is opened?

new OpenOption[]{StandardOpenOption.APPEND, StandardOpenOption.CREATE_NEW}

Although this might look invalid (APPEND doesn't make sense with CREATE_NEW), it is nevertheless a valid combination. It will throw java.nio.file.FileAlreadyExistsException if the file already exists though.
enthuware.ocpjp.v7.2.1551 wrote:Which of the following statements are valid usages of StandardOpenOption options that determine how the file is opened?

new OpenOption[]{StandardOpenOption.APPEND, StandardOpenOption.TRUNCATE_EXISTING}

This is an invalid combination.
I don't quite understand what's the difference between them.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Sun Jun 09, 2013 6:15 am
by admin
Not sure I understand your question. One has CREATE_NEW and other has TRUNCATE_EXISTING. That is the difference.
-Paul.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Sat May 30, 2015 5:20 am
by rvdberg
These questions bothers me.. Is there really no definition of what's valid or not?

If i look at the java sourcecode, all options are passed to newByteChannel(path, options, ..) which is implemented by a <system>FileSystemProvider, thus being only dependent on the OS.

I think makopo did a good observation about the different answers:
new OpenOption[]{StandardOpenOption.APPEND, StandardOpenOption.CREATE_NEW} -> valid
new OpenOption[]{StandardOpenOption.APPEND, StandardOpenOption.TRUNCATE_EXISTING} -> invalid

It doesn't make sense to me. The APPEND seems wrong (or right) in both cases. Either you have a new file, or a truncated file. So how can you know on beforehand what's a valid combination or not? Using the APPEND option doesn't make sense in both combinations, however 1 is marked as valid and 1 is invalid.. ?

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Sat May 30, 2015 8:31 am
by admin
What you say is correct. A lot of it depends on the OS. Unfortunately, we can't do much about it other than make you aware of the issues involved and provide you our best guess.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Thu Jun 01, 2017 3:14 pm
by Cannelids
Hi. The fifth (final) option “new OpenOption[]{StandardOpenOption.READ, StandardOpenOption.SYNC}” is shown as correct, but this seems to contradict the line in the explanation that “READ and SYNC (or DSYNC) cannot go together either because when a file is opened for READ, there is nothing to synch.” Any clarification welcome.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Thu Jun 01, 2017 9:57 pm
by admin
It is marked as correct because it does work but logically it doesn't make sense. As I mentioned above, Unfortunately, we can't do much about it other than make you aware of the issues involved and provide you our best guess.


HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Fri Jun 02, 2017 4:10 am
by Cannelids
Thanks Paul. I still think the explanation does not make this clear, though, as the paragraph begins “JavaDoc API does not explicitly mention which combinations are invalid but it many cases it is easy to spot an invalid combination.”, implying that all the combinations listed below were not only illogical, but actually invalid.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Fri Jun 02, 2017 5:07 am
by admin
You are right. I have updated the explanation to make it more clear.
thank you for your feedback!
Paul.

Re: About Question enthuware.ocpjp.v7.2.1551 :

Posted: Fri Jun 02, 2017 5:46 am
by Cannelids
Thanks again Paul. Great product & service :)