About Question enthuware.ocpjp.v7.2.1551 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
makopo
Posts: 4
Joined: Sat Jun 01, 2013 4:42 am
Contact:

About Question enthuware.ocpjp.v7.2.1551 :

Post by makopo »

Does 1Z0-805 really cover OpenOption or FileChannel?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

OpenOptions, Yes. FileChannel, No.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

makopo
Posts: 4
Joined: Sat Jun 01, 2013 4:42 am
Contact:

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

Post 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.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Not sure I understand your question. One has CREATE_NEW and other has TRUNCATE_EXISTING. That is the difference.
-Paul.
If you like our products and services, please help us by posting your review here.

rvdberg
Posts: 4
Joined: Sat May 30, 2015 4:53 am
Contact:

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

Post 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.. ?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Cannelids
Posts: 25
Joined: Thu Jun 01, 2017 2:50 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Cannelids
Posts: 25
Joined: Thu Jun 01, 2017 2:50 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. I have updated the explanation to make it more clear.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

Cannelids
Posts: 25
Joined: Thu Jun 01, 2017 2:50 pm
Contact:

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

Post by Cannelids »

Thanks again Paul. Great product & service :)

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests