About Question enthuware.ocpjp.v7.2.1551 :
Moderators: Site Manager, fjwalraven
-
- Posts: 4
- Joined: Sat Jun 01, 2013 4:42 am
- Contact:
About Question enthuware.ocpjp.v7.2.1551 :
Does 1Z0-805 really cover OpenOption or FileChannel?
-
- Site Admin
- Posts: 10105
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
OpenOptions, Yes. FileChannel, No.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Sat Jun 01, 2013 4:42 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
Thanks.
Let me another question -
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.
I don't quite understand what's the difference between them.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.
-
- Site Admin
- Posts: 10105
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
Not sure I understand your question. One has CREATE_NEW and other has TRUNCATE_EXISTING. That is the difference.
-Paul.
-Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Sat May 30, 2015 4:53 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
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.. ?
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.. ?
-
- Site Admin
- Posts: 10105
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 25
- Joined: Thu Jun 01, 2017 2:50 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
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.
-
- Site Admin
- Posts: 10105
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 25
- Joined: Thu Jun 01, 2017 2:50 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
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.
-
- Site Admin
- Posts: 10105
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
You are right. I have updated the explanation to make it more clear.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 25
- Joined: Thu Jun 01, 2017 2:50 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1551 :
Thanks again Paul. Great product & service
Who is online
Users browsing this forum: No registered users and 3 guests