Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/main/java/com/datastax/loader/CqlDelimLoad.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,13 @@ else if (format.equalsIgnoreCase("jsonline")
}
if (!STDIN.equalsIgnoreCase(filename)) {
File infile = new File(filename);
if ((!infile.isFile()) && (!infile.isDirectory())) {
System.err.println("The -f argument needs to be a file or a directory");
// Support for named pipes - Support -f as long as readable
// if ((!infile.isFile()) && (!infile.isDirectory())) {
// System.err.println("The -f argument needs to be a file or a directory");
// return false;
// }
if (!infile.canRead()) {
System.err.println("The -f argument needs to be readable");
return false;
}
if (infile.isDirectory()) {
Expand Down Expand Up @@ -615,9 +620,11 @@ public boolean run(String[] args)
}
else {
infile = new File(filename);
if (infile.isFile()) {
}
else {
// Support for named pipes - Do directory stuff only if file is a directory
// if (infile.isFile()) {
// }
// else {
if (infile.isDirectory()) {
inFileList = infile.listFiles();
if (inFileList.length < 1)
throw new IOException("directory is empty");
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/datastax/loader/CqlDelimLoadTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ private void setup() throws IOException, ParseException, org.json.simple.parser.
reader = new BufferedReader(new InputStreamReader(System.in));
readerName = "stdin";
}
// Support for named pipes - must not be gzipped - like stdin
else if (!infile.isFile()) {
InputStream is = new FileInputStream(infile);
reader = new BufferedReader(new InputStreamReader(is));
readerName = infile.getName();
}
else {
InputStream is = null;
try {
Expand Down