Henry Wong wrote:
This week, we're delighted to have Raoul-Gabriel Urma, Mario Fusco & Alan Mycroft helping to answer questions about the new book Modern Java in Action: Lambdas, streams, functional and reactive programming.
The promotion starts Tuesday, December 4th, 2018 and will end on Friday, December 7th, 2018
We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Manning Publications.
Image from https://images-na.ssl-images-amazon.com
Please see the Book Promotion page to ensure your best chances at winning!
And ... the publisher, Manning Publications, is also running a special promotion. Please see these links for more information...
https://www.manning.com/news/countdown-to-2019
https://coderanch.com/t/703089/books/Manning-Tournament
Posts in this welcome thread are not eligible for the drawing, and should be reserved for welcoming the author. Questions posted in this topic are subject to removal.
Danny Markman wrote:Thank you so much for your post very useful. Do I really need certificate or just some portfolio enough to get a proper job? I just don't like to spend my money.
Tim Holloway wrote:I think I can clear up that last.
You're retrieving a collection of "file descriptor" objects. As you call them, metadata. The traditional equivalent for that would be directory entries.
In many filesystems, a directory entry isn't an integral part of a file, it's a distinct object that describes and locates the file within file allocation space. Again, metadata.
In the case of Swift objects, the "locator" part of the metadata is a URL, since Swift storage is http-protocol addressable. That's what you have to get a handle on in order to access the file data itself.
Tim Holloway wrote:OK. You're definitely retrieving Swift objects and not traditional files. Which means that actually this question is a candidate for the Cloud/Virtualization forum.
A superficial check of the docs seems to indicate that what you're doing should work. You could always poke around a bit just to make sure.
Two things that you might try are these:
1. Close the outputstream before you close the Inputstream. You might even want to flush it first. Just in case the copy process needs a bit of jogging.
2. Replace the openStream call with a call to getInput(). They're supposed to function identically, but just in case...
Also try manually reading the InputStream just to see what it returns.
openStream is definitely not returning null. Otherwise it would be causing NullPointerException's. But it could possibly be returning positioned at end-of-file or an empty stream.
Tim Holloway wrote:
You mentioned a Rackspace API (jCloud), however, so I'm not really certain that what you are talking about is a true filesystem. It might be a cloud object store such as Amazon's S3 - or for Openstack, the Swift storage mechanism. In which case, you're not really talking about files as such, but objects addressed (and downloadable) via URL requests. In that case, neither rsync nor nio would work.
Ron McLeod wrote:Rather than create your own network file copy mechanism, you might want to consider using something that already exists - such as a application or library based on SCP or SFTP or rsync.
What operating systems do the server and local platforms run?
Ron McLeod wrote:Maybe I am misunderstanding what you are trying to do, but it sounds like you want to copy a set of files from a server platform to your local platform and maintain the structure of the files that are in the server's file system. Is that correct?
Dustin Ward wrote:How and where would I overwrite the LocalDateTime .toString? Like, I've overwritten all of my CLASS' toString's but how do I just overwrite a random objects?
Because I would really like to print it off without the T and although I elected the military time, I'd like to write it out in standard 1-12 time without making people specify AM or PM when I get their input
Roel De Nijs wrote:
Dustin Ward wrote:I do get a 'T' in the middle of my output though, which is weird...
No, that's not weird at all. It is just the textual (string) representation of a LocalDateTime instance as explained in the toString() method.
Dustin Ward wrote:Ohhhh. Well, it actually works when I insert it into mysql table using DATETIME so I am cool with it
Of course it will work when inserting it into a MySQL database table, because the textual representation is not used in the MySQL driver to insert/updata a DATETIME column. It only offers some information about the object in (hopefully) a human-readible format.
Carey Brown wrote:Your statement
System.out.println(dateTime);
will use the default format which is an international standard which includes the 'T'.