[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

csvwriter to smbfile

Posted on 2014-08-29
2
Medium Priority
?
292 Views
Last Modified: 2014-08-29
Hi;

I have a line of code;
CSVWriter w = new CSVWriter(new PrintWriter(filePath),';', CSVWriter.NO_QUOTE_CHARACTER);

Open in new window


This is successful to write the content locally, but i have to give up the idea as i need to write the file to a network share.

String path= targetshare +  filePath.getPath() + ".csv";
                NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(domain, username, password);
                SmbFile smbFile = new SmbFile(path, auth);
                smbfos = new SmbFileOutputStream(smbFile);
 smbfos.write(...)

Open in new window


I can write it to a network share but the content of the file is 1 liner whereas in local one, it is 5 liner as it should be.

So, practically the format is not suitable for network. I need to give up local idea anyway, but what can i do for this need?

I need to have adapt jcifs smb to open cvs, especially for    
public static final char NO_QUOTE_CHARACTER = '\u0000';


Any hand?

Regards.
0
Comment
Question by:jazzIIIlove
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 40292253
So what's wrong with

CSVWriter w = new CSVWriter(new PrintWriter(new OutputStreamWriter(smbfos)),';', CSVWriter.NO_QUOTE_CHARACTER);

Open in new window


?
0
 
LVL 12

Author Closing Comment

by:jazzIIIlove
ID: 40292977
ah..how rookie i am :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question