Package Torello.Java
Class GSUTIL
- java.lang.Object
-
- Torello.Java.OSCommands
-
- Torello.Java.GSUTIL
-
- All Implemented Interfaces:
java.lang.Cloneable
public class GSUTIL extends OSCommands implements java.lang.Cloneable
This Class ExtendsOSCommands
:
ClassOSCommands
is the parent class for all classes which invoke Operating-System Processes using the Java-Standardjava.lang.Process
Object-Utility.OSCommands
has several constructors inherited by this class which allow a user to configure this class for sending its output in any number of ways toAppendable
instances / loggers of your choice. Read this class documentation about invoking a constructor using any number of log-configurations, for sending text-output to any neccessary destination.
All Methods ReturnOSResponse
:
In addition to real-time process-output printing, this class will collect any all text sent to Standard-Output and Error-Output and save theString
-data for return to the user. All Operating-System calls in this class (which are all invoked by these methods, below) will always return an instance ofOSResponse
.
ClassOSResponse
also contains the fieldresponse
, which signals what the OS-Process' return-value was. Operating-Systems, generally, return a'0'
to indicate the process ran to completion without errors, and some other value to signal an error occurred.Extra's from
:java.lang.Process
in OSExtrasjava.lang.Process
provides several additional-features that allow a user to redirect output, and collect-input to and from any number of additional sources, among others. There is copious documentation aboutOSExtras
, explaining these features.
To specialize an Operating-System call with anOSExtras
instance, just call this class'setOSExtras(...)
method, with any neccessary configurations.This class wraps the Google Cloud command-line tool'gsutil'
, simply using the standard Javajava.lang.Process
object (in addition to Java HTML'sOSResponse
) thereby providing a simple Java-API for these operating-system calls.
This class provides an API into Google Cloud Server functions for manipulating Google Cloud's Storage Buckets. This Class facilitates automating calls to the Google Cloud Shell Command-Line utility named'gsutil'
. Making calls to this UNIX-BASH Executable Command can be very cumbersome. This class will help you save repeated calls to this utility inside into Java Class Files, thereby simplifying the development process quite a bit.
The primary advantage of using this class over BASH Shell Scripts ('.sh'
executable-files), is that it allows for a more unified development process.
Google Cloud Server Account:
Realize, use of this class requires a Google Cloud Account, and it requires being logged onto an instance of Google Cloud Shell. None of the classes in theJava HTML JAR Library
require using GCP - except this one!
Wild Cards:
When the GCP Executable'gsutil'
receives a command that contains Wild Cards (which in'gsutil'
include'*'
,'**'
and'?'
), it will expand and handle them. However, the shell instance running the command will not.
WORA:
In its inception, Java made the "Write Once, Run Anywhere" (WORA) pledge. The methods in this class are not in any way "Java-ized" versions of the Operating System Calls. Rather, they are just wrappers aroundjava.lang.Process
allowing a user to BOTH make Operating System calls easily AND to efficiently retrieve the generated text-output produced by the calls.
The bulk-work of the classes in this JAR Library were written and tested in a UNIX environment. While everything else in theJava HTML JAR Library
is, indeed, O/S Independent (adhering to 'WORA'), this class and all classes which extendOSCommands
are not! In fact, they are highly O/S dependent. The methods in these classes are actually just a set of hooks into native Operating System calls.
This does mean that any invocation of these methods, when running in some other Operating System Environment, will just throw exceptions.
Logging Output:
This class inheritsOSCommands
, which exports fourAppendable
Configuration-Fields for collecting the output of the Operating-System Commands in this class. These fields are all nullable, meaning that when one of these fields are assigned null, no exceptions will throw. Instead, that particular logging feature will simply be deactivated.
The table below explains whatjava.lang.Process
Output-Text is collected by each of thepublic
Configurable-Fields exported by (parent-class)OSCommands
. All four of these are declaredpublic
& non-final
, so they are easily configured - just assign them to anyjava.lang.Appendable
of your choosing!.
Each of these four configuration-fields will log a slightly different variant of thejava.lang.Process
object's output-text.Configurable Field Logged-Text Description / Type outputAppendable
The text that is sent to this log is the unified text produced by reading the java.lang.Process
instance's Standard-Output Stream, and its Error-Output Stream. Both are sent, as best as possible, in the order that such text is received by the reader threads.commandStrAppendable
This log simply collects the actual command being issued to the Process
-Object. The text sent to this log is nothing more than the joined text of input-command'sString[]
-Array.standardOutput
This log collects all text that is sent to Standard-Output when a command is executed. errorOutput
This log collects all text that is sent to Error-Output when a command is executed.
Both Command & Output:
One common trick, in Java HTML, is to provide the sameAppendable
to bothoutputAppendable
andcommandStrAppendable
, which allows for printing a command as it is being executed, and then subsequently, all of its output.
In the two examples below, an instance of this class is built such that BOTH the command as aString
AND the process' output are logged directly to the exact sameAppendable
. Here, the most commonly usedAppendable
of all,java.lang.System.out
, is configured. Note that these two examples are identical, and (slightly) different ways to perform the exact same configurations:
// Use a constructor to build an instance of this class. // Both the Process-Output and the Command-as-a-String are printed to System.out GSUTIL gsutil = new GSUTIL(System.out, System.out, null, null);
// Again - System.out is assigned to both "outputAppendable" and "commandStrAppendable" // The code here is functionally identical to the code in the previous example. GSUTIL gsutil = new GSUTIL(); gsutil.outputAppendable = System.out; gsutil.commandStrAppendable = System.out;
Appendable Help-Reminder:
The following table provides a small reminder & description for several of the common ways to provide a Java Appendable to any method (or field) which accepts anAppendable
type. This table is re-printed in a few locations throughout the Java-HTML Library whereAppendable's
are accepted.
This expects an implementation of Java'sjava.lang.Appendable
interface which allows for a wide range of options when logging intermediate messages.Class or Interface Instance Use & Purpose 'System.out'
Sends text to the standard-out terminal Torello.Java.StorageWriter
Sends text to System.out
, and saves it, internally.FileWriter, PrintWriter, StringWriter
General purpose java text-output classes FileOutputStream, PrintStream
More general-purpose java text-output classes
Checked IOException:
TheAppendable
interface requires that the Checked-ExceptionIOException
be caught when using itsappend(...)
methods.- See Also:
OSCommands
,OSResponse
Hi-Lited Source-Code:- View Here: Torello/Java/GSUTIL.java
- Open New Browser-Tab: Torello/Java/GSUTIL.java
File Size: 46,983 Bytes Line Count: 1,087 '\n' Characters Found
-
-
Field Summary
'Content-Type' HTTP Meta-Data String-Constants Modifier and Type Field static String
SCT_HTML_UTF8
static String
SCT_JAVASCRIPT
static String
SCT_JAVASCRIPT_UTF8
static String
SCT_TEXT_UTF8
-
Fields inherited from class Torello.Java.OSCommands
commandStrAppendable, errorOutput, osExtras, outputAppendable, standardOutput
-
-
Constructor Summary
Constructors Modifier Constructor GSUTIL()
GSUTIL(Appendable outputAppendable)
GSUTIL(Appendable standardOutput, Appendable errorOutput)
GSUTIL(Appendable outputAppendable, Appendable commandStrAppendable, Appendable standardOutput, Appendable errorOutput)
protected
GSUTIL(GSUTIL other)
-
Method Summary
Storage Bucket Contents: Copy Files & Directories Modifier and Type Method OSResponse
CP(Iterable<String> sources, String target, String... switches)
OSResponse
CP(String[] sources, String target, String... switches)
OSResponse
CP(String source, String target, String... switches)
Storage Bucket Contents: Move Files & Directories Modifier and Type Method OSResponse
MV(Iterable<String> sources, String target, String... switches)
OSResponse
MV(String[] sources, String target, String... switches)
OSResponse
MV(String source, String target, String... switches)
Storage Bucket Contents: Delete Files & Directories Modifier and Type Method OSResponse
RM(Iterable<String> iterable, String... switches)
OSResponse
RM(String[] sArr, String... switches)
OSResponse
RM(String s, String... switches)
Storage Bucket Contents: List Files & Directories Modifier and Type Method OSResponse
LS(String s1, String... switches)
Storage Bucket Contents: Synchronize Files & Directories Modifier and Type Method OSResponse
RSYNC(String sources, String target, String... switches)
Google Storage: Make Files Publicly Viewable Modifier and Type Method OSResponse
MP(Iterable<String> iterable, String... extraSwitches)
OSResponse
MP(String[] sArr, String... extraSwitches)
OSResponse
MP(String s1, String... extraSwitches)
Google Storage: Stop Files from being Publicly Viewable Modifier and Type Method OSResponse
SP(Iterable<String> iterable, String... extraSwitches)
OSResponse
SP(String[] sArr, String... extraSwitches)
OSResponse
SP(String s1, String... extraSwitches)
Setting HTTP-Headers for Files: Set Browser-Cache Max-Age Modifier and Type Method OSResponse
SMA(Iterable<String> iterable, int seconds, String... extraSwitches)
OSResponse
SMA(String[] s1Arr, int seconds, String... extraSwitches)
OSResponse
SMA(String s1, int seconds, String... extraSwitches)
Setting HTTP-Headers for Files: Browser-Cache Modifier and Type Method OSResponse
CACHE_CONTROL(Iterable<String> iterable, String cacheControlTags, String... extraSwitches)
OSResponse
CACHE_CONTROL(String[] s1Arr, String cacheControlTags, String... extraSwitches)
OSResponse
CACHE_CONTROL(String s1, String cacheControlTags, String... extraSwitches)
Setting HTTP-Headers for Files: Content-Disposition Modifier and Type Method OSResponse
CONTENT_DISPOSITION(Iterable<String> iterable, String contentDispositionTags, String... extraSwitches)
OSResponse
CONTENT_DISPOSITION(String[] s1Arr, String contentDispositionTags, String... extraSwitches)
OSResponse
CONTENT_DISPOSITION(String s1, String contentDispositionTags, String... extraSwitches)
Setting HTTP-Headers for Files: Content-Encoding Modifier and Type Method OSResponse
CONTENT_ENCODING(Iterable<String> iterable, String contentEncodingTags, String... extraSwitches)
OSResponse
CONTENT_ENCODING(String[] s1Arr, String contentEncodingTags, String... extraSwitches)
OSResponse
CONTENT_ENCODING(String s1, String contentEncodingTags, String... extraSwitches)
Setting HTTP-Headers for Files: Content-Tye Modifier and Type Method OSResponse
CONTENT_TYPE(Iterable<String> iterable, String type, String... extraSwitches)
OSResponse
CONTENT_TYPE(String[] s1Arr, String type, String... extraSwitches)
OSResponse
CONTENT_TYPE(String source, String type, String... extraSwitches)
Setting HTTP-Headers for Files: Customized Meta Data Modifier and Type Method OSResponse
CUSTOM_METADATA(Iterable<String> iterable, String tags, String... extraSwitches)
OSResponse
CUSTOM_METADATA(String[] s1Arr, String metaTag, String... extraSwitches)
OSResponse
CUSTOM_METADATA(String s1, String metaTag, String... extraSwitches)
Methods: interface java.lang.Cloneable Modifier and Type Method GSUTIL
clone()
-
Methods inherited from class Torello.Java.OSCommands
printAndRun, toString
-
-
-
-
Field Detail
-
SCT_TEXT_UTF8
public static final java.lang.String SCT_TEXT_UTF8
Text-File, Plain, UTF-8. NOTE: May be used for calls toSCT(String s1, String type);
- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final String SCT_TEXT_UTF8 = "text/plain; charset=utf-8";
-
SCT_HTML_UTF8
public static final java.lang.String SCT_HTML_UTF8
Text-File, HTML, UTF-8. NOTE: May be used for calls toSCT(String s1, String type);
- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final String SCT_HTML_UTF8 = "text/html; charset=utf-8";
-
SCT_JAVASCRIPT_UTF8
public static final java.lang.String SCT_JAVASCRIPT_UTF8
Text-file, Java-Script, UTF-8. NOTE: This is to be used for calls toSCT(String s1, String type);
- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final String SCT_JAVASCRIPT_UTF8 = "application/javascript; charset=utf-8";
-
SCT_JAVASCRIPT
public static final java.lang.String SCT_JAVASCRIPT
Text-file, Java-Script. NOTE: This is to be used for calls toSCT(String s1, String type);
- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final String SCT_JAVASCRIPT = "application/javascript";
-
-
Constructor Detail
-
GSUTIL
public GSUTIL()
This constructor assigns default values to all of the output loggingAppendable's
.
Note that all of them are assigned 'null' - meaing their output will not be logged - except for the primary outputAppendable
field.this.outputAppendable
. This field is assignedSystem.out
, meaning that all text output by a process will be sent to the terminal window.
-
GSUTIL
public GSUTIL(java.lang.Appendable outputAppendable)
This constructor allows a user to assign an instanceAppendable
to:appendable
.
The first collects all text-output generated by the processes and prints it using theAppendable's
printing methods. This includes text generated for BOTHStandard-Output
ANDError-Output
. This text is collected in real time as it is output by the underlying process.
Assigning null:
Any of this classAppendable's
may be assigned null. When anAppendable
is assigned null, it is simply ignored.NullPointerException
will not throw, and any output text that would be appended, isn't appended.- Parameters:
outputAppendable
- This parameter's reference is assigned directly to theOSCommands
field:appendable
. To clearly understand the use of this field, please review the documentation linked for that field. To summarize, thejava.lang.Appendable
that is synonymously namedappendable
simply collects all output text generated by a processes as it executes, and sends it to the reference'sappend(...)
method. This text will include that sent to BOTHStandard-Output
AND text sent toError-Output
. The text that is printed is transmitted in the order it is received from the reader-threads that read the underlying process' text-pipes.
By default this parameter is assignedSystem.out
. When this default value is used, it means that as the process executes, any and all text it prints is sent to the UNIX or MS-DOS Operating System Terminal Window.
This field may be assigned null, and when so it is just ignored. Assigning null toappendable
. will not produce aNullPointerException
.- See Also:
OSCommands.outputAppendable
- Code:
- Exact Constructor Body:
super(outputAppendable);
-
GSUTIL
public GSUTIL(java.lang.Appendable outputAppendable, java.lang.Appendable commandStrAppendable, java.lang.Appendable standardOutput, java.lang.Appendable errorOutput)
Constructor that allows for assigning all four text-collectingAppendable's
. Please review the documentation for each of these fields to understand better how theseAppendable's
may be used. There are links in the See-Also section, below.
Assigning null:
Any of this classAppendable's
may be assigned null. When anAppendable
is assigned null, it is simply ignored.NullPointerException
will not throw, and any output text that would be appended, isn't appended.- Parameters:
outputAppendable
- This parameter's reference is assigned directly to theOSCommands
field:appendable
. To clearly understand the use of this field, please review the documentation linked for that field. To summarize, thejava.lang.Appendable
that is synonymously namedappendable
simply collects all output text generated by a processes as it executes, and sends it to the reference'sappend(...)
method. This text will include that sent to BOTHStandard-Output
AND text sent toError-Output
. The text that is printed is transmitted in the order it is received from the reader-threads that read the underlying process' text-pipes.
By default this parameter is assignedSystem.out
. When this default value is used, it means that as the process executes, any and all text it prints is sent to the UNIX or MS-DOS Operating System Terminal Window.
This field may be assigned null, and when so it is just ignored. Assigning null toappendable
. will not produce aNullPointerException
.commandStrAppendable
- Thisjava.lang.Appendable
allows for yet another output mechanism when executing operating system commands. The sole purpose of thisAppendable
is to print the process command, itself, as a JavaString
- exactly as it was issued to the operating system.
This allows a type of "Monitor Log" to store all commands being issued to the Operating-System, without having to include the full-text output that those process calls have produced. The value passed to this parameter is assigned to theOSCommands
field namedprintCmdAppendable
.
This parameter may be null, and if it is, no such output will be generated.standardOutput
- ThisAppendable
is assigned to the internalOSCommands
field:standardOutput
. ThisAppendabe
, as the name hopefully implies, allows a user to collect any / all text sent by the process toStandard-Output
.
Please review the documentation for that field to better understand it's use. Also, keep in mind that null may be passed to this parameter, and if / when it is the correspondingAppendable
field will simply be ignored during the process execution.errorOutput
- ThisAppendable
is assigned to the internalOSCommands
field:errorOutput
. ThisAppendabe
, as the name hopefully implies, allows a user to collect any / all text sent by the process toError-Output
.
Please review the documentation for that field to better understand it's use. Also, keep in mind that null may be passed to this parameter, and if / when it is the correspondingAppendable
field will simply be ignored during the process execution.- See Also:
OSCommands.outputAppendable
,OSCommands.commandStrAppendable
,OSCommands.standardOutput
,OSCommands.errorOutput
- Code:
- Exact Constructor Body:
super(outputAppendable, commandStrAppendable, standardOutput, errorOutput);
-
GSUTIL
public GSUTIL(java.lang.Appendable standardOutput, java.lang.Appendable errorOutput)
This constructor assigns values to these internalAppendable
fields:standardOutput
anderrorOutput
Assigning null:
Any of this classAppendable's
may be assigned null. When anAppendable
is assigned null, it is simply ignored.NullPointerException
will not throw, and any output text that would be appended, isn't appended.- Parameters:
standardOutput
- ThisAppendable
is assigned to the internalOSCommands
field:standardOutput
. ThisAppendabe
, as the name hopefully implies, allows a user to collect any / all text sent by the process toStandard-Output
.
Please review the documentation for that field to better understand it's use. Also, keep in mind that null may be passed to this parameter, and if / when it is the correspondingAppendable
field will simply be ignored during the process execution.errorOutput
- ThisAppendable
is assigned to the internalOSCommands
field:errorOutput
. ThisAppendabe
, as the name hopefully implies, allows a user to collect any / all text sent by the process toError-Output
.
Please review the documentation for that field to better understand it's use. Also, keep in mind that null may be passed to this parameter, and if / when it is the correspondingAppendable
field will simply be ignored during the process execution.- See Also:
OSCommands.standardOutput
,OSCommands.errorOutput
- Code:
- Exact Constructor Body:
super(standardOutput, errorOutput);
-
GSUTIL
-
-
Method Detail
-
clone
public GSUTIL clone()
Creates a clone of'this'
instance. Though unlikely of much use, this could conceivably have some function if similar, but non-identical, output mechanisms were being used.- Specified by:
clone
in classOSCommands
- Returns:
- An exact copy of
'this'
instance - one in which all outputAppendable's
have had their references copied into the new instance. - Code:
- Exact Method Body:
return new GSUTIL(this);
-
RM
public OSResponse RM(java.lang.String s, java.lang.String... switches) throws java.io.IOException
Calls gsutil with"rm"
arguments.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m rm <switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s
- The GCS bucket-storage address of files to delete. Can Include wildcards:'*'
and'**'
switches
- This may be appended to the command, providing Google's'gsutil'
with switches.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "rm" }, switches, s, NO_TARGET); return printAndRun(command);
-
RM
public OSResponse RM(java.lang.Iterable<java.lang.String> iterable, java.lang.String... switches) throws java.io.IOException
- Code:
- Exact Method Body:
return RM(TO_ARRAY(iterable), switches);
-
RM
public OSResponse RM(java.lang.String[] sArr, java.lang.String... switches) throws java.io.IOException
Calls gsutil with"rm"
arguments.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m rm <switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
sArr
- The list GCS bucket-storage address of files to delete. Can Include wildcards:'*'
and'**'
switches
- This may be appended to the command, providing Google's'gsutil'
with switches.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "rm" }, switches, sArr, NO_TARGET); return printAndRun(command);
-
MV
public OSResponse MV(java.lang.String source, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Calls gsutil with"mv"
arguments.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m mv <switches> <source(s)> <target>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
source
- The GCS bucket-storage source-address. Can Include wildcards:'*'
and'**'
target
- The GCS bucket-storage target-address.switches
- This may be appended to the command, providing Google's'gsutil'
with switches.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "mv" }, switches, source, target); return printAndRun(command);
-
MV
public OSResponse MV(java.lang.Iterable<java.lang.String> sources, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Convenience Method
Invokes:MV(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return MV(TO_ARRAY(sources), target, switches);
-
MV
public OSResponse MV(java.lang.String[] sources, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Calls gsutil with"mv"
arguments.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m mv <switches> <source(s)> <target>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
sources
- A list of arguments that need to be copied, as an array. Can Include wildcards:'*'
and'**'
target
- The target/destination address for the list of files to be copied.switches
- This may be appended to the command, providing Google's'gsutil'
with switches.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "mv" }, switches, sources, target); return printAndRun(command);
-
CP
public OSResponse CP(java.lang.String source, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Calls gsutil with the"cp"
argument.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m cp <switches> <source(s)> <target>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
source
- The GCS bucket-storage source-address, or local BASH shell source-address. Can Include wildcards:'*'
and'**'
target
- The GCS bucket-storage target-address, or local BASH shell target-address.switches
- This may be appended to the command, providing Google's'gsutil'
with switches.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "cp" }, switches, source, target); return printAndRun(command);
-
CP
public OSResponse CP(java.lang.Iterable<java.lang.String> sources, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Convenience Method
Invokes:CP(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return CP(TO_ARRAY(sources), target, switches);
-
CP
public OSResponse CP(java.lang.String[] sources, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Calls gsutil with the"cp"
argument.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m cp <switches> <source(s)> <target>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
sources
- A list of arguments that need to be copied, as an array. Can Include wildcards:'*'
and'**'
target
- The target/destination address for the list of files to be copied.switches
- This may be appended to the command, providing Google's'gsutil'
with switches.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "cp" }, switches, sources, target); return printAndRun(command);
-
RSYNC
public OSResponse RSYNC(java.lang.String sources, java.lang.String target, java.lang.String... switches) throws java.io.IOException
Calls gsutil with arguments:"-m rsync ..."
. This method synchronizes a local directory with the directory in a Google Cloud Storage Bucket.
NOTE: 'rsync' crashed my whole cloud-shell... Use at your discretion. The command was properly formed, to the best of my knowledge. It complained of 'egress' for quite a few days after using gsutil with the'rsync'
option.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m rsync <switches> <source(s)> <target>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
sources
- The source-address.target
- The target-address.switches
- This may be appended to the command, providing Google's'gsutil'
with switches.
'-d' : This will inform GSUTIL to remove files that are not found in the users directory, but are sitting on the Storage Bucket Server Location - in the corresponding / same directory
'-r' : This will cause the sync to run recursively.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND (new String[] { "gsutil", "-m", "rsync" }, switches, sources, target); return printAndRun(command);
-
MP
public OSResponse MP(java.lang.String s1, java.lang.String... extraSwitches) throws java.io.IOException
MP stands for "Make Public" - and this method is used to force the target file or files on Google Cloud Server to become "visible" to the public. It updates the Access Control List.
SPECIFICALLY: It grants read access to the public / "AllUsers". This is the most-common means I have found for allowing the Google-Web-Server to serve up files from a Google Cloud Storage Bucket. Remember, this only works if you have registered your bucket with a domain-name server. This is usually around $12 per year.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m acl ch -u AllUsers:R <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- The GCS bucket file or directory address. Note'*'
or'**'
may be used here.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the public-visibility of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "acl", "ch", "-u", "AllUsers:R" }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
MP
public OSResponse MP(java.lang.Iterable<java.lang.String> iterable, java.lang.String... extraSwitches) throws java.io.IOException
- Code:
- Exact Method Body:
return MP(TO_ARRAY(iterable), extraSwitches);
-
MP
public OSResponse MP(java.lang.String[] sArr, java.lang.String... extraSwitches) throws java.io.IOException
MP stands for "Make Public" - and this method is used to force the target file or files on Google Cloud Server to become "visible" to the public. It updates the Access Control List.
SPECIFICALLY: It grants read access to the public / "AllUsers". This is the most-common means I have found for allowing the Google-Web-Server to serve up files from a Google Cloud Storage Bucket. Remember, this only works if you have registered your bucket with a domain-name server. This is usually around $12 per year.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m acl ch -u AllUsers:R <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
sArr
- The GCS bucket file or directory addresses. Note'*'
or'**'
may be used here.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the public-visibility of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "acl", "ch", "-u", "AllUsers:R" }, extraSwitches, sArr, NO_TARGET ); return printAndRun(command);
-
SP
public OSResponse SP(java.lang.String s1, java.lang.String... extraSwitches) throws java.io.IOException
SP stands for "Stop Public" - and this method is used to force the target file or files on Google Cloud Server to become "invisible" to the public. It updates the Access Control List.
SPECIFICALLY: It revokes read access to the public / "AllUsers".
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m acl ch -d AllUsers <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- The GCS bucket file or directory address. Note'*'
or'**'
may be used here.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to stop the public-visibility of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "acl", "ch", "-d", "AllUsers" }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
SP
public OSResponse SP(java.lang.Iterable<java.lang.String> iterable, java.lang.String... extraSwitches) throws java.io.IOException
- Code:
- Exact Method Body:
return SP(TO_ARRAY(iterable), extraSwitches);
-
SP
public OSResponse SP(java.lang.String[] sArr, java.lang.String... extraSwitches) throws java.io.IOException
SP stands for "Stop Public" - and this method is used to force the target file or files on Google Cloud Server to become "invisible" to the public. It updates the Access Control List.
SPECIFICALLY: It revokes read access to the public / "AllUsers".
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m acl ch -d AllUsers <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
sArr
- The GCS bucket file or directory address. Note'*'
or'**'
may be used here.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to stop the public-visibility of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "acl", "ch", "-d", "AllUsers" }, extraSwitches, sArr, NO_TARGET ); return printAndRun(command);
-
SMA
public OSResponse SMA(java.lang.String s1, int seconds, java.lang.String... extraSwitches) throws java.io.IOException
SMA is short of "Set Max Age." This handles the problem of browsers that cache stale output data. When the "max-age" meta-tag is set to zero, your browser will always poll the Google Cloud Server for new page-information, rather than relying on cached pages. This method is extremely helpful if you are debugging and changing web-content while hosting a web-site domain using GCS Storage Buckets.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Cache-Control:public, max-age=<seconds>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- The GCS bucket-storage address. gs://bucket-name/directoryname/filename
NOTE: "filename" may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.seconds
- This parameter is added to the end of the max-age= string in the cmdSMA argument list. It represents the number of seconds a browser is allowed to cache a page.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the max-age of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", ("Cache-Control:public, max-age=" + seconds + "") }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
SMA
public OSResponse SMA(java.lang.Iterable<java.lang.String> iterable, int seconds, java.lang.String... extraSwitches) throws java.io.IOException
Convenience Method
Invokes:SMA(String[], int, String[])
.
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return SMA(TO_ARRAY(iterable), seconds, extraSwitches);
-
SMA
public OSResponse SMA(java.lang.String[] s1Arr, int seconds, java.lang.String... extraSwitches) throws java.io.IOException
SMA is short of "Set Max Age." This handles the problem of browsers that cache stale output data. When the "max-age" meta-tag is set to zero, your browser will always poll the Google Cloud Server for new page-information, rather than relying on cached pages. This method is extremely helpful if you are debugging and changing web-content while hosting a web-site domain using GCS Storage Buckets.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Cache-Control:public, max-age=<seconds>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
seconds
- This parameter is added to the end of the max-age= string in the cmdSMA argument list. It represents the number of seconds a browser is allowed to cache a page.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the max-age of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", ("Cache-Control:public, max-age=" + seconds + "") }, extraSwitches, s1Arr, NO_TARGET ); return printAndRun(command);
-
CONTENT_TYPE
public OSResponse CONTENT_TYPE(java.lang.String source, java.lang.String type, java.lang.String... extraSwitches) throws java.io.IOException
Whenever programming involves foreign-languages or UTF-8, this can be a meta-tag (or web-server setting) that has to be set. It is not mandatory to set this meta-tag with Google-Cloud-Server when working with higher-order UTF-8 character-data, because the meta-information can be placed inside the HTML page itself. However, this is an "alternative-option" to putting meta-information inside your server pages header-sections.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Content-Type: <type>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.
NOTE: Most often, I use this command to set files to "UTF-8" and not Plain-Old ASCII (like here):"Content-Type: text/plain; charset=utf-8"
- Parameters:
source
- This is the parameter is supposed to be a file, directory, or expression sequence.
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.type
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Content-Type". There are several pre-defined content-type strings defined in this class that make reasonable values for this parameter.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the content-type of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
SCT_TEXT_UTF8
,SCT_HTML_UTF8
,SCT_JAVASCRIPT
,OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Content-Type: " + type }, extraSwitches, source, NO_TARGET ); return printAndRun(command);
-
CONTENT_TYPE
public OSResponse CONTENT_TYPE (java.lang.Iterable<java.lang.String> iterable, java.lang.String type, java.lang.String... extraSwitches) throws java.io.IOException
Convenience Method
Invokes:CONTENT_TYPE(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return CONTENT_TYPE(TO_ARRAY(iterable), type, extraSwitches);
-
CONTENT_TYPE
public OSResponse CONTENT_TYPE(java.lang.String[] s1Arr, java.lang.String type, java.lang.String... extraSwitches) throws java.io.IOException
Whenever programming involves foreign-languages or UTF-8, this can be a meta-tag (or web-server setting) that has to be set. It is not mandatory to set this meta-tag with Google-Cloud-Server when working with higher-order UTF-8 character-data, because the meta-information can be placed inside the HTML page itself. However, this is an "alternative-option" to putting meta-information inside your server pages header-sections.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Content-Type: <type>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.
NOTE: Most often, I use this command to set files to "UTF-8" and not Plain-Old ASCII (like here):"Content-Type: text/plain; charset=utf-8"
- Parameters:
s1Arr
- The GCS bucket-storage address list. gs://bucket-name/directoryname/filename
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.type
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Content-Type". There are several pre-defined content-type strings defined in this class that make reasonable values for this parameter.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the content-type of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
SCT_TEXT_UTF8
,SCT_HTML_UTF8
,SCT_JAVASCRIPT
,OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Content-Type: " + type }, extraSwitches, s1Arr, NO_TARGET ); return printAndRun(command);
-
CACHE_CONTROL
public OSResponse CACHE_CONTROL(java.lang.String s1, java.lang.String cacheControlTags, java.lang.String... extraSwitches) throws java.io.IOException
Cache-Control
is an HTTP setting, much likeContent-Type
. This HTTP-Handshake setting informs a web-browser what the rules need to be as far as caching web-pages. Some web-pages have extremely static-content that will never change, and when a browser caches this content, there will be no loss of information to the end-user. Other-times web-pages are returned from live-data-feeds that change the content of the page often. This method here is a more generalized version of the method above namedpublic static void SMA(...)
- which stands for 'set max age'. Setting the max-age allows a web-programmer to specify that certain files should not be cached by the web-browser.
AS AN ASIDE: A very large head-ache in the development process with Google Cloud Server Storage Buckets is remembering to set the "Max-Age" to ZERO, to guarantee that after each iteration of coding or developing, when HTML files are updated and replaced, the browser being used to look at the HTML does not cache the previous iteration/data results.
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Cache-Control: <cacheControlTags>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- This is the parameter is supposed to be a file, directory, or expression sequence
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.cacheControlTags
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Cache-Control"extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the cache-control of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Cache-Control: " + cacheControlTags }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
CACHE_CONTROL
public OSResponse CACHE_CONTROL (java.lang.Iterable<java.lang.String> iterable, java.lang.String cacheControlTags, java.lang.String... extraSwitches) throws java.io.IOException
Convenience Method
Invokes:CACHE_CONTROL(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return CACHE_CONTROL(TO_ARRAY(iterable), cacheControlTags, extraSwitches);
-
CACHE_CONTROL
public OSResponse CACHE_CONTROL(java.lang.String[] s1Arr, java.lang.String cacheControlTags, java.lang.String... extraSwitches) throws java.io.IOException
Cache-Control
is an HTTP setting, much likeContent-Type
. This HTTP-Handshake setting informs a web-browser what the rules need to be as far as caching web-pages. Some web-pages have extremely static-content that will never change, and when a browser caches this content, there will be no loss of information to the end-user. Other-times web-pages are returned from live-data-feeds that change the content of the page often. This method here is a more generalized version of the method above namedpublic static void SMA(...)
- which stands for 'set max age'. Setting the max-age allows a web-programmer to specify that certain files should not be cached by the web-browser.
AS AN ASIDE: A very large head-ache in the development process with Google Cloud Server Storage Buckets is remembering to set the "Max-Age" to ZERO, to guarantee that after each iteration of coding or developing, when HTML files are updated and replaced, the browser being used to look at the HTML does not cache the previous iteration/data results.
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Cache-Control: <cacheControlTags>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1Arr
- This is the parameter is supposed to be a file, directory, or expression sequence.
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.cacheControlTags
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Cache-Control"extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the cache-control of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Cache-Control: " + cacheControlTags }, extraSwitches, s1Arr, NO_TARGET ); return printAndRun(command);
-
CONTENT_ENCODING
public OSResponse CONTENT_ENCODING(java.lang.String s1, java.lang.String contentEncodingTags, java.lang.String... extraSwitches) throws java.io.IOException
Content-Encoding
is an HTTP setting, much likeContent-Type
, but for the purposes of News-Scraping and other Internet Publishing, it has not been used much, if at all, during the development of these packages.
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Content-Encoding: <contentEncodingTags>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- This is the parameter is supposed to be a file, directory, or expression sequence
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.contentEncodingTags
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Content-Encoding"extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the content-encoding of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Content-Encoding: " + contentEncodingTags }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
CONTENT_ENCODING
public OSResponse CONTENT_ENCODING(java.lang.String[] s1Arr, java.lang.String contentEncodingTags, java.lang.String... extraSwitches) throws java.io.IOException
Content-Encoding
is an HTTP setting, much likeContent-Type
, but for the purposes of News-Scraping and other Internet Publishing, it has not been used much, if at all, during the development of these packages.
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Content-Encoding: <contentEncodingTags>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1Arr
- This is the parameter is supposed to be a file, directory, or expression sequence.
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.contentEncodingTags
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Content-Encoding"extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the content-encoding of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Content-Encoding: " + contentEncodingTags }, extraSwitches, s1Arr, NO_TARGET ); return printAndRun(command);
-
CONTENT_ENCODING
public OSResponse CONTENT_ENCODING (java.lang.Iterable<java.lang.String> iterable, java.lang.String contentEncodingTags, java.lang.String... extraSwitches) throws java.io.IOException
Convenience Method
Invokes:CONTENT_ENCODING(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return CONTENT_ENCODING(TO_ARRAY(iterable), contentEncodingTags, extraSwitches);
-
CONTENT_DISPOSITION
public OSResponse CONTENT_DISPOSITION (java.lang.String s1, java.lang.String contentDispositionTags, java.lang.String... extraSwitches) throws java.io.IOException
Content-Disposition
is an HTTP setting, much likeContent-Type
, but for the purposes of News-Scraping and other Internet Publishing, it has not been used much, if at all, during the development of these packages.
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Content-Disposition: <contentDispositionTags>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- This is the parameter is supposed to be a file, directory, or expression sequence
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.contentDispositionTags
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Content-Disposition"extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the content-disposition of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Content-Disposition: " + contentDispositionTags }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
CONTENT_DISPOSITION
public OSResponse CONTENT_DISPOSITION (java.lang.Iterable<java.lang.String> iterable, java.lang.String contentDispositionTags, java.lang.String... extraSwitches) throws java.io.IOException
Convenience Method
Invokes:CONTENT_DISPOSITION(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return CONTENT_DISPOSITION(TO_ARRAY(iterable), contentDispositionTags, extraSwitches);
-
CONTENT_DISPOSITION
public OSResponse CONTENT_DISPOSITION (java.lang.String[] s1Arr, java.lang.String contentDispositionTags, java.lang.String... extraSwitches) throws java.io.IOException
Content-Disposition
is an HTTP setting, much likeContent-Type
, but for the purposes of News-Scraping and other Internet Publishing, it has not been used much, if at all, during the development of these packages.
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h "Content-Disposition: <contentDispositionTags>" <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, in case multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1Arr
- This is the parameter is supposed to be a file, directory, or expression sequence.
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.contentDispositionTags
- This is any'String'
that may be used with Google Cloud Server. Must pertain to "Content-Disposition"extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the content-disposition of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", "Content-Disposition: " + contentDispositionTags }, extraSwitches, s1Arr, NO_TARGET ); return printAndRun(command);
-
CUSTOM_METADATA
public OSResponse CUSTOM_METADATA(java.lang.String s1, java.lang.String metaTag, java.lang.String... extraSwitches) throws java.io.IOException
This just allows you to set custom HTTP-Header tags. When reviewing the Google Cloud Server Documentation Pages for'GSUTIL'
they provide this example of a "Custom Meta HTTP Tag." The following text-and-example are directly copied from:
https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadataAll fields and their values must consist only of ASCII characters, with the exception of values for x-goog-meta- fields, which may contain arbitrary Unicode values. Note that when setting metadata using the XML API, which sends custom metadata as HTTP headers, Unicode characters will be encoded using UTF-8, then url-encoded to ASCII. For example:
UNIX or DOS Shell Command:
gsutil setmeta -h "x-goog-meta-foo: ã" gs://bucket/objectwould store the custom metadata key-value pair of"foo"
and"%C3%A3".
Subsequently, running"ls -L"
using the JSON API to list the object's metadata would print"%C3%A3"
, while"ls -L"
using the XML API would url-decode this value automatically, printing the character"ã".
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h <metaTag> <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, whenever multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- This is the parameter is supposed to be a file, directory, or expression sequence
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.metaTag
- This is any'String'
that may be used with Google Cloud Server's'setmeta'
parameter forgsutil
.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the meta-information of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", metaTag }, extraSwitches, s1, NO_TARGET ); return printAndRun(command);
-
CUSTOM_METADATA
public OSResponse CUSTOM_METADATA (java.lang.Iterable<java.lang.String> iterable, java.lang.String tags, java.lang.String... extraSwitches) throws java.io.IOException
Convenience Method
Invokes:CUSTOM_METADATA(String[], String, String[])
Converts:Iterable<String>
toString[] Array
- Code:
- Exact Method Body:
return CUSTOM_METADATA(TO_ARRAY(iterable), tags, extraSwitches);
-
CUSTOM_METADATA
public OSResponse CUSTOM_METADATA(java.lang.String[] s1Arr, java.lang.String metaTag, java.lang.String... extraSwitches) throws java.io.IOException
This just allows you to set custom HTTP-Header tags. When reviewing the Google Cloud Server Documentation Pages for'GSUTIL'
they provide this example of a "Custom Meta HTTP Tag." The following text-and-example are directly copied from:
https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadataAll fields and their values must consist only of ASCII characters, with the exception of values for x-goog-meta- fields, which may contain arbitrary Unicode values. Note that when setting metadata using the XML API, which sends custom metadata as HTTP headers, Unicode characters will be encoded using UTF-8, then url-encoded to ASCII. For example:
UNIX or DOS Shell Command:
gsutil setmeta -h "x-goog-meta-foo: ã" gs://bucket/objectwould store the custom metadata key-value pair of"foo"
and"%C3%A3".
Subsequently, running"ls -L"
using the JSON API to list the object's metadata would print"%C3%A3"
, while"ls -L"
using the XML API would url-decode this value automatically, printing the character"ã".
The four primary "HTTP Settings" according to Google Cloud Server Storage Buckets include:Content-Type, Content-Encoding, Content-Disposition, Content-Language, Cache-Control
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil -m setmeta -h <metaTag> <extra-switches> <source(s)>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, whenever multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1Arr
- This is the parameter is supposed to be a file, directory, or expression sequence.
NOTE: The'source(s)'
may contain the asterisks'*'
or anything that would normally be passed to gsutil on the shell command-line.metaTag
- This is any'String'
that may be used with Google Cloud Server's'setmeta'
parameter forgsutil
.extraSwitches
- This may be appended to the command, providing Google's'gsutil'
with switches. The salient arguments to set the meta-information of a web-page have already been included. This parameter is only important if there are other switches, in addition to the ones already used by the constructor for this command.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- If there are any problems while invoking the operating-system command- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND( new String[] { "gsutil", "-m", "setmeta", "-h", metaTag }, extraSwitches, s1Arr, NO_TARGET ); return printAndRun(command);
-
LS
public OSResponse LS(java.lang.String s1, java.lang.String... switches) throws java.io.IOException
Lists the contents of a directory in a Google Cloud Storage Bucket.
Google Cloud Shell Equivalent:
user@cloudshell:
~
(project-ID)
$ gsutil ls <fileOrDir>
Google Note: Google expects that when multiple files or directories are processed, that a'-m'
flag is passed to the command to increase efficiency. Therefore, whenever multiple files or directories are passed to the source parameters, this flag is added to the command, automatically.- Parameters:
s1
- The GCS storage file or directory. Note:'*'
or'**'
may be used.- Returns:
- Returns an instance of
OSResponse
. This response-Object
(data-record) class holds fourpublic, final
fields:
① Processresponse-code
② Text sent toStandard-Output
(as ajava.lang.String
)
③ Text sent toError-Output
(also as aString
)
④ The original Command-String
ThisOSResponse
instance may be discarded without any effect onProcess
Execution. It is only provided as a convenience in case more information is required about the results of theO/S
command invocation.
Process Status: Upon completion of this method, theOperating-System java.lang.Process
is guaranteed to have run to completion (or to have failed and been interrupted). If the process was interrupted, theresponse-code
will indicate this using the valueINTERRUPTED
- Throws:
java.io.IOException
- See Also:
OSCommands.printAndRun(String[])
- Code:
- Exact Method Body:
String[] command = BUILD_COMMAND(new String[] { "gsutil", "ls" }, switches, s1, NO_TARGET); return printAndRun(command);
-
-