final class FileOperation extends Logging
Provides methods for working on files in a stage.
To access an object of this class, use Session.file .
For example:
// Upload a file to a stage. session.file.put("file:///tmp/file1.csv", "@myStage/prefix1") // Download a file from a stage. session.file.get("@myStage/prefix1/file1.csv", "file:///tmp")
- Since
-
0.4.0
- Alphabetic
- By Inheritance
- FileOperation
- Logging
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=
(
arg0:
Any
)
:
Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##
()
:
Int
- Definition Classes
- AnyRef → Any
-
final
def
==
(
arg0:
Any
)
:
Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf
[
T0
]
:
T0
- Definition Classes
- Any
-
def
clone
()
:
AnyRef
- Attributes
- protected[ lang ]
- Definition Classes
- AnyRef
- Annotations
- @throws ( ... ) @native () @HotSpotIntrinsicCandidate ()
-
def
downloadStream
(
stageLocation:
String
,
decompress:
Boolean
)
:
InputStream
Download file from the given stage and return an input stream
Download file from the given stage and return an input stream
- stageLocation
-
Full stage path to the file
- decompress
-
True if file compressed
- returns
-
An InputStream object
- Since
-
1.4.0
-
final
def
eq
(
arg0:
AnyRef
)
:
Boolean
- Definition Classes
- AnyRef
-
def
equals
(
arg0:
Any
)
:
Boolean
- Definition Classes
- AnyRef → Any
-
def
get
(
stageLocation:
String
,
targetDirectory:
String
,
options:
Map
[
String
,
String
] =
Map()
)
:
Array
[
GetResult
]
Downloads the specified files from a path in a stage (specified by
stageLocation
) to the local directory specified bytargetLocation
.Downloads the specified files from a path in a stage (specified by
stageLocation
) to the local directory specified bytargetLocation
.This method returns the results as an Array of GetResult objects (one for each file). Each object represents the results of downloading a file.
For example:
// Upload files to a stage. session.file.put("file:///tmp/file_1.csv", "@myStage/prefix2") session.file.put("file:///tmp/file_2.csv", "@myStage/prefix2") // Download one file from a stage. val res1 = session.file.get("@myStage/prefix2/file_1.csv", "file:///tmp/target") // Download all the files from @myStage/prefix2. val res2 = session.file.get("@myStage/prefix2", "file:///tmp/target2") // Download files with names that match a regular expression pattern. val getOptions = Map("PATTERN" -> s"'.*file_.*.csv.gz'") val res3 = session.file.get("@myStage/prefix2", "file:///tmp/target3", getOptions)
- stageLocation
-
The location (a directory or filename on a stage) from which you want to download the files. The
@
prefix is optional. - targetDirectory
-
The path to the local directory where the file(s) should be downloaded. Specify the path in the following format:
file://<path_to_file>/<filename>
. IftargetDirectory
does not already exist, the method creates the directory. - options
-
A Map containing the names and values of optional parameters for the GET command.
- returns
-
An Array of PutResult objects (one object for each file downloaded).
- Since
-
0.4.0
-
final
def
getClass
()
:
Class
[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native () @HotSpotIntrinsicCandidate ()
-
def
hashCode
()
:
Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native () @HotSpotIntrinsicCandidate ()
-
final
def
isInstanceOf
[
T0
]
:
Boolean
- Definition Classes
- Any
-
def
log
()
:
Logger
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logDebug
(
msg:
String
,
throwable:
Throwable
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logDebug
(
msg:
String
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logError
(
msg:
String
,
throwable:
Throwable
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logError
(
msg:
String
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logInfo
(
msg:
String
,
throwable:
Throwable
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logInfo
(
msg:
String
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logTrace
(
msg:
String
,
throwable:
Throwable
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logTrace
(
msg:
String
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logWarning
(
msg:
String
,
throwable:
Throwable
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
def
logWarning
(
msg:
String
)
:
Unit
- Attributes
- protected[ internal ]
- Definition Classes
- Logging
-
final
def
ne
(
arg0:
AnyRef
)
:
Boolean
- Definition Classes
- AnyRef
-
final
def
notify
()
:
Unit
- Definition Classes
- AnyRef
- Annotations
- @native () @HotSpotIntrinsicCandidate ()
-
final
def
notifyAll
()
:
Unit
- Definition Classes
- AnyRef
- Annotations
- @native () @HotSpotIntrinsicCandidate ()
-
def
put
(
localFileName:
String
,
stageLocation:
String
,
options:
Map
[
String
,
String
] =
Map()
)
:
Array
[
PutResult
]
Uploads the local files specified by
localFileName
to the stage location specified instageLocation
.Uploads the local files specified by
localFileName
to the stage location specified instageLocation
.This method returns the results as an Array of PutResult objects (one for each file). Each object represents the results of uploading a file.
For example:
// Upload a file to a stage without compressing the file. val putOptions = Map("AUTO_COMPRESS" -> "FALSE") val res1 = session.file.put("file:///tmp/file1.csv", "@myStage", putOptions) // Upload the CSV files in /tmp with names that start with "file". // You can use the wildcard characters "*" and "?" to match multiple files. val res2 = session.file.put("file:///tmp/file*.csv", "@myStage/prefix2")
- localFileName
-
The path to the local file(s) to upload. Specify the path in the following format:
file://<path_to_file>/<filename>
. (Thefile://
prefix is optional.) To match multiple files in the path, you can specify the wildcard characters*
and?
. - stageLocation
-
The stage (and prefix) where you want to upload the file(s). The
@
prefix is optional. - options
-
A Map containing the names and values of optional parameters for the PUT command.
- returns
-
An Array of PutResult objects (one object for each file uploaded).
- Since
-
0.4.0
-
final
def
synchronized
[
T0
]
(
arg0: ⇒
T0
)
:
T0
- Definition Classes
- AnyRef
-
def
toString
()
:
String
- Definition Classes
- AnyRef → Any
-
def
uploadStream
(
stageLocation:
String
,
inputStream:
InputStream
,
compress:
Boolean
)
:
Unit
Method to compress data from a stream and upload it at a stage location.
Method to compress data from a stream and upload it at a stage location. The data will be uploaded as one file. No splitting is done in this method.
caller is responsible for releasing the inputStream after the method is called.
- stageLocation
-
Full stage path to the file
- inputStream
-
Input stream from which the data will be uploaded
- compress
-
Compress data or not before uploading stream
- Since
-
1.4.0
-
final
def
wait
(
arg0:
Long
,
arg1:
Int
)
:
Unit
- Definition Classes
- AnyRef
- Annotations
- @throws ( ... )
-
final
def
wait
(
arg0:
Long
)
:
Unit
- Definition Classes
- AnyRef
- Annotations
- @throws ( ... ) @native ()
-
final
def
wait
()
:
Unit
- Definition Classes
- AnyRef
- Annotations
- @throws ( ... )
Deprecated Value Members
-
def
finalize
()
:
Unit
- Attributes
- protected[ lang ]
- Definition Classes
- AnyRef
- Annotations
- @throws ( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated