Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
embulk-input-filename
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Klaus Wölfel
embulk-input-filename
Commits
a01f0f71
Commit
a01f0f71
authored
Aug 04, 2017
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the last_path
parent
a3fe2add
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
src/main/java/org/embulk/input/filename/FilenameInputPlugin.java
...n/java/org/embulk/input/filename/FilenameInputPlugin.java
+17
-2
No files found.
src/main/java/org/embulk/input/filename/FilenameInputPlugin.java
View file @
a01f0f71
...
@@ -98,6 +98,8 @@ public class FilenameInputPlugin
...
@@ -98,6 +98,8 @@ public class FilenameInputPlugin
private
static
int
chunkSize
;
private
static
int
chunkSize
;
private
static
ArrayList
<
String
>
last_p
=
new
ArrayList
<
String
>();
@Override
@Override
public
ConfigDiff
transaction
(
ConfigSource
config
,
public
ConfigDiff
transaction
(
ConfigSource
config
,
InputPlugin
.
Control
control
)
InputPlugin
.
Control
control
)
...
@@ -164,6 +166,7 @@ public class FilenameInputPlugin
...
@@ -164,6 +166,7 @@ public class FilenameInputPlugin
// End of sort
// End of sort
allFiles
.
add
(
files
);
allFiles
.
add
(
files
);
last_p
.
add
(
files
.
get
(
0
));
}
}
...
@@ -182,6 +185,8 @@ public class FilenameInputPlugin
...
@@ -182,6 +185,8 @@ public class FilenameInputPlugin
}
}
task
.
setFiles
(
oneFile
);
task
.
setFiles
(
oneFile
);
taskCount
=
oneFile
.
size
();
taskCount
=
oneFile
.
size
();
last_p
=
new
ArrayList
<
String
>();
last_p
.
add
(
allFiles
.
get
(
0
).
get
(
0
));
}
else
{
}
else
{
task
.
setFiles
(
allFiles
);
task
.
setFiles
(
allFiles
);
taskCount
=
allFiles
.
size
();
taskCount
=
allFiles
.
size
();
...
@@ -207,7 +212,10 @@ public class FilenameInputPlugin
...
@@ -207,7 +212,10 @@ public class FilenameInputPlugin
InputPlugin
.
Control
control
)
InputPlugin
.
Control
control
)
{
{
control
.
run
(
taskSource
,
schema
,
taskCount
);
control
.
run
(
taskSource
,
schema
,
taskCount
);
return
Exec
.
newConfigDiff
();
ConfigDiff
diff
=
Exec
.
newConfigDiff
();
diff
.
set
(
"last_path"
,
last_p
);
return
diff
;
}
}
@Override
@Override
...
@@ -233,6 +241,7 @@ public class FilenameInputPlugin
...
@@ -233,6 +241,7 @@ public class FilenameInputPlugin
{
{
int
nRead
;
int
nRead
;
byte
[]
data
=
new
byte
[
chunkSize
];
byte
[]
data
=
new
byte
[
chunkSize
];
String
filename
=
new
File
(
file
).
getCanonicalPath
();
FileInputStream
dataIn
=
new
FileInputStream
(
file
);
FileInputStream
dataIn
=
new
FileInputStream
(
file
);
ByteArrayOutputStream
buffer
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
buffer
=
new
ByteArrayOutputStream
();
...
@@ -241,12 +250,18 @@ public class FilenameInputPlugin
...
@@ -241,12 +250,18 @@ public class FilenameInputPlugin
try
(
PageBuilder
pageBuilder
=
new
PageBuilder
(
Exec
.
getBufferAllocator
(),
schema
,
output
))
try
(
PageBuilder
pageBuilder
=
new
PageBuilder
(
Exec
.
getBufferAllocator
(),
schema
,
output
))
{
{
pageBuilder
.
setString
(
0
,
buffer
.
toString
());
//Base64.encodeBase64String(buffer.toByteArray()));
pageBuilder
.
setString
(
0
,
buffer
.
toString
());
//Base64.encodeBase64String(buffer.toByteArray()));
pageBuilder
.
setString
(
1
,
tagList
.
get
(
taskIndex
)
+
new
File
(
file
).
getCanonicalPath
()
);
pageBuilder
.
setString
(
1
,
tagList
.
get
(
taskIndex
)
+
filename
);
pageBuilder
.
addRecord
();
pageBuilder
.
addRecord
();
buffer
.
flush
();
buffer
.
flush
();
pageBuilder
.
finish
();
pageBuilder
.
finish
();
}
}
}
}
if
(
last_p
.
size
()
>
1
)
{
last_p
.
set
(
taskIndex
,
filename
);
}
else
{
last_p
.
set
(
0
,
filename
);
}
}
catch
(
IOException
ex
){
}
catch
(
IOException
ex
){
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment