id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
113,000 | GoogleCloudPlatform/bigdata-interop | util-hadoop/src/main/java/com/google/cloud/hadoop/util/CredentialFromAccessTokenProviderClassFactory.java | CredentialFromAccessTokenProviderClassFactory.credential | public static Credential credential(
AccessTokenProviderClassFromConfigFactory providerClassFactory,
Configuration config,
Collection<String> scopes)
throws IOException, GeneralSecurityException {
Class<? extends AccessTokenProvider> clazz =
providerClassFactory.getAccessTokenProvide... | java | public static Credential credential(
AccessTokenProviderClassFromConfigFactory providerClassFactory,
Configuration config,
Collection<String> scopes)
throws IOException, GeneralSecurityException {
Class<? extends AccessTokenProvider> clazz =
providerClassFactory.getAccessTokenProvide... | [
"public",
"static",
"Credential",
"credential",
"(",
"AccessTokenProviderClassFromConfigFactory",
"providerClassFactory",
",",
"Configuration",
"config",
",",
"Collection",
"<",
"String",
">",
"scopes",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"... | Generate the credential.
<p>If the {@link AccessTokenProviderClassFromConfigFactory} generates no Class for the
provider, return null. | [
"Generate",
"the",
"credential",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util-hadoop/src/main/java/com/google/cloud/hadoop/util/CredentialFromAccessTokenProviderClassFactory.java#L98-L116 |
113,001 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java | BigQueryFactory.createBigQueryCredential | public Credential createBigQueryCredential(Configuration config)
throws GeneralSecurityException, IOException {
Credential credential =
CredentialFromAccessTokenProviderClassFactory.credential(
new AccessTokenProviderClassFromConfigFactory().withOverridePrefix("mapred.bq"),
con... | java | public Credential createBigQueryCredential(Configuration config)
throws GeneralSecurityException, IOException {
Credential credential =
CredentialFromAccessTokenProviderClassFactory.credential(
new AccessTokenProviderClassFromConfigFactory().withOverridePrefix("mapred.bq"),
con... | [
"public",
"Credential",
"createBigQueryCredential",
"(",
"Configuration",
"config",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"Credential",
"credential",
"=",
"CredentialFromAccessTokenProviderClassFactory",
".",
"credential",
"(",
"new",
"AccessToke... | Construct credentials from the passed Configuration.
@throws IOException on IO Error.
@throws GeneralSecurityException on General Security Error. | [
"Construct",
"credentials",
"from",
"the",
"passed",
"Configuration",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java#L86-L102 |
113,002 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java | BigQueryFactory.getBigQuery | public Bigquery getBigQuery(Configuration config)
throws GeneralSecurityException, IOException {
logger.atInfo().log("Creating BigQuery from default credential.");
Credential credential = createBigQueryCredential(config);
// Use the credential to create an authorized BigQuery client
return getBigQ... | java | public Bigquery getBigQuery(Configuration config)
throws GeneralSecurityException, IOException {
logger.atInfo().log("Creating BigQuery from default credential.");
Credential credential = createBigQueryCredential(config);
// Use the credential to create an authorized BigQuery client
return getBigQ... | [
"public",
"Bigquery",
"getBigQuery",
"(",
"Configuration",
"config",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"logger",
".",
"atInfo",
"(",
")",
".",
"log",
"(",
"\"Creating BigQuery from default credential.\"",
")",
";",
"Credential",
"cred... | Constructs a BigQuery from the credential constructed from the environment.
@throws IOException on IO Error.
@throws GeneralSecurityException on General Security Error. | [
"Constructs",
"a",
"BigQuery",
"from",
"the",
"credential",
"constructed",
"from",
"the",
"environment",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java#L118-L124 |
113,003 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java | BigQueryFactory.getBigQueryFromCredential | public Bigquery getBigQueryFromCredential(Credential credential, String appName) {
logger.atInfo().log("Creating BigQuery from given credential.");
// Use the credential to create an authorized BigQuery client
if (credential != null) {
return new Bigquery
.Builder(HTTP_TRANSPORT, JSON_FACTOR... | java | public Bigquery getBigQueryFromCredential(Credential credential, String appName) {
logger.atInfo().log("Creating BigQuery from given credential.");
// Use the credential to create an authorized BigQuery client
if (credential != null) {
return new Bigquery
.Builder(HTTP_TRANSPORT, JSON_FACTOR... | [
"public",
"Bigquery",
"getBigQueryFromCredential",
"(",
"Credential",
"credential",
",",
"String",
"appName",
")",
"{",
"logger",
".",
"atInfo",
"(",
")",
".",
"log",
"(",
"\"Creating BigQuery from given credential.\"",
")",
";",
"// Use the credential to create an author... | Constructs a BigQuery from a given Credential. | [
"Constructs",
"a",
"BigQuery",
"from",
"a",
"given",
"Credential",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java#L129-L139 |
113,004 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryUtils.java | BigQueryUtils.waitForJobCompletion | public static void waitForJobCompletion(
Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff pollBackOff =
new ExponentialBackOff.Builder()
.setMaxInterva... | java | public static void waitForJobCompletion(
Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff pollBackOff =
new ExponentialBackOff.Builder()
.setMaxInterva... | [
"public",
"static",
"void",
"waitForJobCompletion",
"(",
"Bigquery",
"bigquery",
",",
"String",
"projectId",
",",
"JobReference",
"jobReference",
",",
"Progressable",
"progressable",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Sleeper",
"sleeper",
... | Polls job until it is completed.
@param bigquery the Bigquery instance to poll.
@param projectId the project that is polling.
@param jobReference the job to poll.
@param progressable to get progress of task.
@throws IOException on IO Error.
@throws InterruptedException on sleep interrupt. | [
"Polls",
"job",
"until",
"it",
"is",
"completed",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryUtils.java#L66-L124 |
113,005 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryUtils.java | BigQueryUtils.getSchemaFromString | public static List<TableFieldSchema> getSchemaFromString(String fields) {
logger.atFine().log("getSchemaFromString('%s')", fields);
// Parse the output schema for Json from fields.
JsonParser jsonParser = new JsonParser();
JsonArray json = jsonParser.parse(fields).getAsJsonArray();
List<TableFieldS... | java | public static List<TableFieldSchema> getSchemaFromString(String fields) {
logger.atFine().log("getSchemaFromString('%s')", fields);
// Parse the output schema for Json from fields.
JsonParser jsonParser = new JsonParser();
JsonArray json = jsonParser.parse(fields).getAsJsonArray();
List<TableFieldS... | [
"public",
"static",
"List",
"<",
"TableFieldSchema",
">",
"getSchemaFromString",
"(",
"String",
"fields",
")",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"getSchemaFromString('%s')\"",
",",
"fields",
")",
";",
"// Parse the output schema for Json fro... | Parses the given JSON string and returns the extracted schema.
@param fields a string to read the TableSchema from.
@return the List of TableFieldSchema described by the string fields. | [
"Parses",
"the",
"given",
"JSON",
"string",
"and",
"returns",
"the",
"extracted",
"schema",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryUtils.java#L132-L175 |
113,006 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.initialize | public void initialize(URI path, Configuration config, boolean initSuperclass)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(path != null, "path must not be null");
Preconditions.checkArgument(config != null, "config must not be null");
Preconditions.checkArg... | java | public void initialize(URI path, Configuration config, boolean initSuperclass)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(path != null, "path must not be null");
Preconditions.checkArgument(config != null, "config must not be null");
Preconditions.checkArg... | [
"public",
"void",
"initialize",
"(",
"URI",
"path",
",",
"Configuration",
"config",
",",
"boolean",
"initSuperclass",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"Preconditions",
".",
"checkArgument",
... | Initializes this file system instance.
Note:
The path passed to this method could be path of any file/directory.
It does not matter because the only thing we check is whether
it uses 'gs' scheme. The rest is ignored.
@param path URI of a file/directory within this file system.
@param config Hadoop configuration.
@par... | [
"Initializes",
"this",
"file",
"system",
"instance",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L594-L629 |
113,007 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.initializeDelegationTokenSupport | private void initializeDelegationTokenSupport(Configuration config, URI path) throws IOException {
logger.atFine().log("GHFS.initializeDelegationTokenSupport");
// Load delegation token binding, if support is configured
GcsDelegationTokens dts = new GcsDelegationTokens();
Text service = new Text(getSche... | java | private void initializeDelegationTokenSupport(Configuration config, URI path) throws IOException {
logger.atFine().log("GHFS.initializeDelegationTokenSupport");
// Load delegation token binding, if support is configured
GcsDelegationTokens dts = new GcsDelegationTokens();
Text service = new Text(getSche... | [
"private",
"void",
"initializeDelegationTokenSupport",
"(",
"Configuration",
"config",
",",
"URI",
"path",
")",
"throws",
"IOException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHFS.initializeDelegationTokenSupport\"",
")",
";",
"// Load delegation... | Initialize the delegation token support for this filesystem.
@param config The filesystem configuration
@param path The filesystem path
@throws IOException | [
"Initialize",
"the",
"delegation",
"token",
"support",
"for",
"this",
"filesystem",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L638-L654 |
113,008 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.getDefaultPort | @Override
protected int getDefaultPort() {
logger.atFine().log("GHFS.getDefaultPort:");
int result = -1;
logger.atFine().log("GHFS.getDefaultPort:=> %s", result);
return result;
} | java | @Override
protected int getDefaultPort() {
logger.atFine().log("GHFS.getDefaultPort:");
int result = -1;
logger.atFine().log("GHFS.getDefaultPort:=> %s", result);
return result;
} | [
"@",
"Override",
"protected",
"int",
"getDefaultPort",
"(",
")",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHFS.getDefaultPort:\"",
")",
";",
"int",
"result",
"=",
"-",
"1",
";",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"... | The default port is listed as -1 as an indication that ports are not used. | [
"The",
"default",
"port",
"is",
"listed",
"as",
"-",
"1",
"as",
"an",
"indication",
"that",
"ports",
"are",
"not",
"used",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L667-L673 |
113,009 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.create | @Override
public FSDataOutputStream create(
Path hadoopPath,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgume... | java | @Override
public FSDataOutputStream create(
Path hadoopPath,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgume... | [
"@",
"Override",
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"hadoopPath",
",",
"FsPermission",
"permission",
",",
"boolean",
"overwrite",
",",
"int",
"bufferSize",
",",
"short",
"replication",
",",
"long",
"blockSize",
",",
"Progressable",
"progress",
... | Opens the given file for writing.
<p>Note: This function overrides the given bufferSize value with a higher number unless further
overridden using configuration parameter {@code fs.gs.outputstream.buffer.size}.
@param hadoopPath The file to open.
@param permission Permissions to set on the new file. Ignored.
@param o... | [
"Opens",
"the",
"given",
"file",
"for",
"writing",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L733-L783 |
113,010 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.concat | @Override
public void concat(Path trg, Path[] psrcs) throws IOException {
logger.atFine().log("GHFS.concat: %s, %s", trg, lazy(() -> Arrays.toString(psrcs)));
checkArgument(psrcs.length > 0, "psrcs must have at least one source");
URI trgPath = getGcsPath(trg);
List<URI> srcPaths = Arrays.stream(psr... | java | @Override
public void concat(Path trg, Path[] psrcs) throws IOException {
logger.atFine().log("GHFS.concat: %s, %s", trg, lazy(() -> Arrays.toString(psrcs)));
checkArgument(psrcs.length > 0, "psrcs must have at least one source");
URI trgPath = getGcsPath(trg);
List<URI> srcPaths = Arrays.stream(psr... | [
"@",
"Override",
"public",
"void",
"concat",
"(",
"Path",
"trg",
",",
"Path",
"[",
"]",
"psrcs",
")",
"throws",
"IOException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHFS.concat: %s, %s\"",
",",
"trg",
",",
"lazy",
"(",
"(",
")",
... | Concat existing files into one file.
@param trg the path to the target destination.
@param psrcs the paths to the sources to use for the concatenation.
@throws IOException IO failure | [
"Concat",
"existing",
"files",
"into",
"one",
"file",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L846-L870 |
113,011 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.rename | @Override
public boolean rename(Path src, Path dst) throws IOException {
// Even though the underlying GCSFS will also throw an IAE if src is root, since our filesystem
// root happens to equal the global root, we want to explicitly check it here since derived
// classes may not have filesystem roots equa... | java | @Override
public boolean rename(Path src, Path dst) throws IOException {
// Even though the underlying GCSFS will also throw an IAE if src is root, since our filesystem
// root happens to equal the global root, we want to explicitly check it here since derived
// classes may not have filesystem roots equa... | [
"@",
"Override",
"public",
"boolean",
"rename",
"(",
"Path",
"src",
",",
"Path",
"dst",
")",
"throws",
"IOException",
"{",
"// Even though the underlying GCSFS will also throw an IAE if src is root, since our filesystem",
"// root happens to equal the global root, we want to explicit... | Renames src to dst. Src must not be equal to the filesystem root.
@param src Source path.
@param dst Destination path.
@return true if rename succeeds.
@throws FileNotFoundException if src does not exist.
@throws IOException if an error occurs. | [
"Renames",
"src",
"to",
"dst",
".",
"Src",
"must",
"not",
"be",
"equal",
"to",
"the",
"filesystem",
"root",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L881-L918 |
113,012 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.listStatus | @Override
public FileStatus[] listStatus(Path hadoopPath)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.listStatus: %s", hadoopPath);
URI gcsPath = getGcsPath(... | java | @Override
public FileStatus[] listStatus(Path hadoopPath)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.listStatus: %s", hadoopPath);
URI gcsPath = getGcsPath(... | [
"@",
"Override",
"public",
"FileStatus",
"[",
"]",
"listStatus",
"(",
"Path",
"hadoopPath",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"hadoopPath",
"!=",
... | Lists file status. If the given path points to a directory then the status
of children is returned, otherwise the status of the given file is returned.
@param hadoopPath Given path.
@return File status list or null if path does not exist.
@throws IOException if an error occurs. | [
"Lists",
"file",
"status",
".",
"If",
"the",
"given",
"path",
"points",
"to",
"a",
"directory",
"then",
"the",
"status",
"of",
"children",
"is",
"returned",
"otherwise",
"the",
"status",
"of",
"the",
"given",
"file",
"is",
"returned",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L968-L997 |
113,013 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.setWorkingDirectory | @Override
public void setWorkingDirectory(Path hadoopPath) {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
logger.atFine().log("GHFS.setWorkingDirectory: %s", hadoopPath);
URI gcsPath = FileInfo.convertToDirectoryPath(pathCodec, ge... | java | @Override
public void setWorkingDirectory(Path hadoopPath) {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
logger.atFine().log("GHFS.setWorkingDirectory: %s", hadoopPath);
URI gcsPath = FileInfo.convertToDirectoryPath(pathCodec, ge... | [
"@",
"Override",
"public",
"void",
"setWorkingDirectory",
"(",
"Path",
"hadoopPath",
")",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"hadoopPath",
"!=",
"null",
",",
"\"hadoopPath must not... | Sets the current working directory to the given path.
@param hadoopPath New working directory. | [
"Sets",
"the",
"current",
"working",
"directory",
"to",
"the",
"given",
"path",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1004-L1024 |
113,014 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.mkdirs | @Override
public boolean mkdirs(Path hadoopPath, FsPermission permission)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.mkdirs: %s, perm: %s", hadoopPath, permissi... | java | @Override
public boolean mkdirs(Path hadoopPath, FsPermission permission)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.mkdirs: %s, perm: %s", hadoopPath, permissi... | [
"@",
"Override",
"public",
"boolean",
"mkdirs",
"(",
"Path",
"hadoopPath",
",",
"FsPermission",
"permission",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"ha... | Makes the given path and all non-existent parents directories.
Has the semantics of Unix 'mkdir -p'.
@param hadoopPath Given path.
@param permission Permissions to set on the given directory.
@return true on success, false otherwise.
@throws IOException if an error occurs. | [
"Makes",
"the",
"given",
"path",
"and",
"all",
"non",
"-",
"existent",
"parents",
"directories",
".",
"Has",
"the",
"semantics",
"of",
"Unix",
"mkdir",
"-",
"p",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1046-L1070 |
113,015 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.getFileStatus | @Override
public FileStatus getFileStatus(Path hadoopPath)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.getFileStatus: %s", hadoopPath);
URI gcsPath = getGcsP... | java | @Override
public FileStatus getFileStatus(Path hadoopPath)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.getFileStatus: %s", hadoopPath);
URI gcsPath = getGcsP... | [
"@",
"Override",
"public",
"FileStatus",
"getFileStatus",
"(",
"Path",
"hadoopPath",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"hadoopPath",
"!=",
"null",
... | Gets status of the given path item.
@param hadoopPath The path we want information about.
@return A FileStatus object for the given path.
@throws FileNotFoundException when the path does not exist;
@throws IOException on other errors. | [
"Gets",
"status",
"of",
"the",
"given",
"path",
"item",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1088-L1112 |
113,016 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.getFileStatus | private FileStatus getFileStatus(FileInfo fileInfo, String userName) throws IOException {
// GCS does not provide modification time. It only provides creation time.
// It works for objects because they are immutable once created.
FileStatus status =
new FileStatus(
fileInfo.getSize(),
... | java | private FileStatus getFileStatus(FileInfo fileInfo, String userName) throws IOException {
// GCS does not provide modification time. It only provides creation time.
// It works for objects because they are immutable once created.
FileStatus status =
new FileStatus(
fileInfo.getSize(),
... | [
"private",
"FileStatus",
"getFileStatus",
"(",
"FileInfo",
"fileInfo",
",",
"String",
"userName",
")",
"throws",
"IOException",
"{",
"// GCS does not provide modification time. It only provides creation time.",
"// It works for objects because they are immutable once created.",
"FileSt... | Gets FileStatus corresponding to the given FileInfo value. | [
"Gets",
"FileStatus",
"corresponding",
"to",
"the",
"given",
"FileInfo",
"value",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1115-L1133 |
113,017 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.globStatus | @Override
public FileStatus[] globStatus(Path pathPattern, PathFilter filter) throws IOException {
checkOpen();
logger.atFine().log("GHFS.globStatus: %s", pathPattern);
// URI does not handle glob expressions nicely, for the purpose of
// fully-qualifying a path we can URI-encode them.
// Using t... | java | @Override
public FileStatus[] globStatus(Path pathPattern, PathFilter filter) throws IOException {
checkOpen();
logger.atFine().log("GHFS.globStatus: %s", pathPattern);
// URI does not handle glob expressions nicely, for the purpose of
// fully-qualifying a path we can URI-encode them.
// Using t... | [
"@",
"Override",
"public",
"FileStatus",
"[",
"]",
"globStatus",
"(",
"Path",
"pathPattern",
",",
"PathFilter",
"filter",
")",
"throws",
"IOException",
"{",
"checkOpen",
"(",
")",
";",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHFS.globStatus: %... | Returns an array of FileStatus objects whose path names match pathPattern and is accepted by
the user-supplied path filter. Results are sorted by their path names.
<p>Return null if pathPattern has no glob and the path does not exist. Return an empty array if
pathPattern has a glob and no path matches it.
@param path... | [
"Returns",
"an",
"array",
"of",
"FileStatus",
"objects",
"whose",
"path",
"names",
"match",
"pathPattern",
"and",
"is",
"accepted",
"by",
"the",
"user",
"-",
"supplied",
"path",
"filter",
".",
"Results",
"are",
"sorted",
"by",
"their",
"path",
"names",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1222-L1247 |
113,018 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.concurrentGlobInternal | private FileStatus[] concurrentGlobInternal(Path fixedPath, PathFilter filter)
throws IOException {
ExecutorService executorService = Executors.newFixedThreadPool(2, DAEMON_THREAD_FACTORY);
Callable<FileStatus[]> flatGlobTask = () -> flatGlobInternal(fixedPath, filter);
Callable<FileStatus[]> nonFlatG... | java | private FileStatus[] concurrentGlobInternal(Path fixedPath, PathFilter filter)
throws IOException {
ExecutorService executorService = Executors.newFixedThreadPool(2, DAEMON_THREAD_FACTORY);
Callable<FileStatus[]> flatGlobTask = () -> flatGlobInternal(fixedPath, filter);
Callable<FileStatus[]> nonFlatG... | [
"private",
"FileStatus",
"[",
"]",
"concurrentGlobInternal",
"(",
"Path",
"fixedPath",
",",
"PathFilter",
"filter",
")",
"throws",
"IOException",
"{",
"ExecutorService",
"executorService",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"2",
",",
"DAEMON_THREAD_FACT... | Use 2 glob algorithms that return the same result but one of them could be significantly faster
than another one depending on directory layout. | [
"Use",
"2",
"glob",
"algorithms",
"that",
"return",
"the",
"same",
"result",
"but",
"one",
"of",
"them",
"could",
"be",
"significantly",
"faster",
"than",
"another",
"one",
"depending",
"on",
"directory",
"layout",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1253-L1266 |
113,019 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.getHomeDirectory | @Override
public Path getHomeDirectory() {
Path result = new Path(getFileSystemRoot(), getHomeDirectorySubpath());
logger.atFine().log("GHFS.getHomeDirectory:=> %s", result);
return result;
} | java | @Override
public Path getHomeDirectory() {
Path result = new Path(getFileSystemRoot(), getHomeDirectorySubpath());
logger.atFine().log("GHFS.getHomeDirectory:=> %s", result);
return result;
} | [
"@",
"Override",
"public",
"Path",
"getHomeDirectory",
"(",
")",
"{",
"Path",
"result",
"=",
"new",
"Path",
"(",
"getFileSystemRoot",
"(",
")",
",",
"getHomeDirectorySubpath",
"(",
")",
")",
";",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHF... | Returns home directory of the current user.
Note: This directory is only used for Hadoop purposes.
It is not the same as a user's OS home directory. | [
"Returns",
"home",
"directory",
"of",
"the",
"current",
"user",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1382-L1387 |
113,020 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.fileStatusToString | private static String fileStatusToString(FileStatus stat) {
assert stat != null;
return String.format(
"path: %s, isDir: %s, len: %d, owner: %s",
stat.getPath().toString(),
stat.isDir(),
stat.getLen(),
stat.getOwner());
} | java | private static String fileStatusToString(FileStatus stat) {
assert stat != null;
return String.format(
"path: %s, isDir: %s, len: %d, owner: %s",
stat.getPath().toString(),
stat.isDir(),
stat.getLen(),
stat.getOwner());
} | [
"private",
"static",
"String",
"fileStatusToString",
"(",
"FileStatus",
"stat",
")",
"{",
"assert",
"stat",
"!=",
"null",
";",
"return",
"String",
".",
"format",
"(",
"\"path: %s, isDir: %s, len: %d, owner: %s\"",
",",
"stat",
".",
"getPath",
"(",
")",
".",
"toS... | Converts the given FileStatus to its string representation.
@param stat FileStatus to convert.
@return String representation of the given FileStatus. | [
"Converts",
"the",
"given",
"FileStatus",
"to",
"its",
"string",
"representation",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1395-L1404 |
113,021 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.copyIfNotPresent | private static void copyIfNotPresent(Configuration config, String deprecatedKey, String newKey) {
String deprecatedValue = config.get(deprecatedKey);
if (config.get(newKey) == null && deprecatedValue != null) {
logger.atWarning().log(
"Key %s is deprecated. Copying the value of key %s to new key... | java | private static void copyIfNotPresent(Configuration config, String deprecatedKey, String newKey) {
String deprecatedValue = config.get(deprecatedKey);
if (config.get(newKey) == null && deprecatedValue != null) {
logger.atWarning().log(
"Key %s is deprecated. Copying the value of key %s to new key... | [
"private",
"static",
"void",
"copyIfNotPresent",
"(",
"Configuration",
"config",
",",
"String",
"deprecatedKey",
",",
"String",
"newKey",
")",
"{",
"String",
"deprecatedValue",
"=",
"config",
".",
"get",
"(",
"deprecatedKey",
")",
";",
"if",
"(",
"config",
"."... | Copy the value of the deprecated key to the new key if a value is present for the deprecated
key, but not the new key. | [
"Copy",
"the",
"value",
"of",
"the",
"deprecated",
"key",
"to",
"the",
"new",
"key",
"if",
"a",
"value",
"is",
"present",
"for",
"the",
"deprecated",
"key",
"but",
"not",
"the",
"new",
"key",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1483-L1491 |
113,022 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.copyDeprecatedConfigurationOptions | private static void copyDeprecatedConfigurationOptions(Configuration config) {
copyIfNotPresent(
config,
GoogleHadoopFileSystemConfiguration.AUTH_SERVICE_ACCOUNT_ENABLE.getKey(),
AUTHENTICATION_PREFIX + HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX);
copyIfNotPresent(
... | java | private static void copyDeprecatedConfigurationOptions(Configuration config) {
copyIfNotPresent(
config,
GoogleHadoopFileSystemConfiguration.AUTH_SERVICE_ACCOUNT_ENABLE.getKey(),
AUTHENTICATION_PREFIX + HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX);
copyIfNotPresent(
... | [
"private",
"static",
"void",
"copyDeprecatedConfigurationOptions",
"(",
"Configuration",
"config",
")",
"{",
"copyIfNotPresent",
"(",
"config",
",",
"GoogleHadoopFileSystemConfiguration",
".",
"AUTH_SERVICE_ACCOUNT_ENABLE",
".",
"getKey",
"(",
")",
",",
"AUTHENTICATION_PREF... | Copy deprecated configuration options to new keys, if present. | [
"Copy",
"deprecated",
"configuration",
"options",
"to",
"new",
"keys",
"if",
"present",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1496-L1526 |
113,023 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.configure | private synchronized void configure(Configuration config) throws IOException {
logger.atFine().log("GHFS.configure");
logger.atFine().log("GHFS_ID = %s", GHFS_ID);
overrideConfigFromFile(config);
copyDeprecatedConfigurationOptions(config);
// Set this configuration as the default config for this in... | java | private synchronized void configure(Configuration config) throws IOException {
logger.atFine().log("GHFS.configure");
logger.atFine().log("GHFS_ID = %s", GHFS_ID);
overrideConfigFromFile(config);
copyDeprecatedConfigurationOptions(config);
// Set this configuration as the default config for this in... | [
"private",
"synchronized",
"void",
"configure",
"(",
"Configuration",
"config",
")",
"throws",
"IOException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHFS.configure\"",
")",
";",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GH... | Configures GHFS using the supplied configuration.
@param config Hadoop configuration object. | [
"Configures",
"GHFS",
"using",
"the",
"supplied",
"configuration",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1577-L1622 |
113,024 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageStrings.java | GoogleCloudStorageStrings.matchListPrefix | public static String matchListPrefix(
String objectNamePrefix, String delimiter, String objectName) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(objectName),
"objectName must not be null or empty, had args %s/%s/%s: ",
objectNamePrefix, delimiter, objectName);
// The suffix th... | java | public static String matchListPrefix(
String objectNamePrefix, String delimiter, String objectName) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(objectName),
"objectName must not be null or empty, had args %s/%s/%s: ",
objectNamePrefix, delimiter, objectName);
// The suffix th... | [
"public",
"static",
"String",
"matchListPrefix",
"(",
"String",
"objectNamePrefix",
",",
"String",
"delimiter",
",",
"String",
"objectName",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"objectName",
")",
",",
... | Helper that mimics the GCS API behavior for taking an existing objectName and checking if it
matches a user-supplied prefix with an optional directory "delimiter". If it matches, either
the full objectName will be returned unmodified, or the return value will be a String that
is a prefix of the objectName inclusive of ... | [
"Helper",
"that",
"mimics",
"the",
"GCS",
"API",
"behavior",
"for",
"taking",
"an",
"existing",
"objectName",
"and",
"checking",
"if",
"it",
"matches",
"a",
"user",
"-",
"supplied",
"prefix",
"with",
"an",
"optional",
"directory",
"delimiter",
".",
"If",
"it... | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageStrings.java#L44-L73 |
113,025 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java | GoogleCloudStorageReadChannel.position | @Override
public SeekableByteChannel position(long newPosition) throws IOException {
throwIfNotOpen();
if (newPosition == currentPosition) {
return this;
}
validatePosition(newPosition);
logger.atFine().log(
"Seek from %s to %s position for '%s'", currentPosition, newPosition, reso... | java | @Override
public SeekableByteChannel position(long newPosition) throws IOException {
throwIfNotOpen();
if (newPosition == currentPosition) {
return this;
}
validatePosition(newPosition);
logger.atFine().log(
"Seek from %s to %s position for '%s'", currentPosition, newPosition, reso... | [
"@",
"Override",
"public",
"SeekableByteChannel",
"position",
"(",
"long",
"newPosition",
")",
"throws",
"IOException",
"{",
"throwIfNotOpen",
"(",
")",
";",
"if",
"(",
"newPosition",
"==",
"currentPosition",
")",
"{",
"return",
"this",
";",
"}",
"validatePositi... | Sets this channel's position.
<p>This method will throw an exception if {@code newPosition} is greater than object size,
which contradicts {@link SeekableByteChannel#position(long) SeekableByteChannel} contract.
TODO(user): decide if this needs to be fixed.
@param newPosition the new position, counting the number of ... | [
"Sets",
"this",
"channel",
"s",
"position",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java#L589-L602 |
113,026 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java | GoogleCloudStorageReadChannel.validatePosition | protected void validatePosition(long position) throws IOException {
if (position < 0) {
throw new EOFException(
String.format(
"Invalid seek offset: position value (%d) must be >= 0 for '%s'",
position, resourceIdString));
}
if (size >= 0 && position >= size) {
... | java | protected void validatePosition(long position) throws IOException {
if (position < 0) {
throw new EOFException(
String.format(
"Invalid seek offset: position value (%d) must be >= 0 for '%s'",
position, resourceIdString));
}
if (size >= 0 && position >= size) {
... | [
"protected",
"void",
"validatePosition",
"(",
"long",
"position",
")",
"throws",
"IOException",
"{",
"if",
"(",
"position",
"<",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
"String",
".",
"format",
"(",
"\"Invalid seek offset: position value (%d) must be >= ... | Validates that the given position is valid for this channel. | [
"Validates",
"that",
"the",
"given",
"position",
"is",
"valid",
"for",
"this",
"channel",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java#L697-L711 |
113,027 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopOutputStream.java | GoogleHadoopOutputStream.write | @Override
public void write(byte[] b, int offset, int len) throws IOException {
long startTime = System.nanoTime();
out.write(b, offset, len);
statistics.incrementBytesWritten(len);
long duration = System.nanoTime() - startTime;
ghfs.increment(GoogleHadoopFileSystemBase.Counter.WRITE);
ghfs.in... | java | @Override
public void write(byte[] b, int offset, int len) throws IOException {
long startTime = System.nanoTime();
out.write(b, offset, len);
statistics.incrementBytesWritten(len);
long duration = System.nanoTime() - startTime;
ghfs.increment(GoogleHadoopFileSystemBase.Counter.WRITE);
ghfs.in... | [
"@",
"Override",
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"out",
".",
"write",
"(",
"b",
"... | Writes to this output stream 'len' bytes of the specified buffer starting at the given offset. | [
"Writes",
"to",
"this",
"output",
"stream",
"len",
"bytes",
"of",
"the",
"specified",
"buffer",
"starting",
"at",
"the",
"given",
"offset",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopOutputStream.java#L111-L119 |
113,028 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.addModificationTimeToAttributes | public static void addModificationTimeToAttributes(Map<String, byte[]> attributes, Clock clock) {
attributes.put(FILE_MODIFICATION_TIMESTAMP_KEY, Longs.toByteArray(clock.currentTimeMillis()));
} | java | public static void addModificationTimeToAttributes(Map<String, byte[]> attributes, Clock clock) {
attributes.put(FILE_MODIFICATION_TIMESTAMP_KEY, Longs.toByteArray(clock.currentTimeMillis()));
} | [
"public",
"static",
"void",
"addModificationTimeToAttributes",
"(",
"Map",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"attributes",
",",
"Clock",
"clock",
")",
"{",
"attributes",
".",
"put",
"(",
"FILE_MODIFICATION_TIMESTAMP_KEY",
",",
"Longs",
".",
"toByteArray... | Add a key and value representing the current time, as determined by the passed clock, to the
passed attributes dictionary.
@param attributes The file attributes map to update
@param clock The clock to retrieve the current time from | [
"Add",
"a",
"key",
"and",
"value",
"representing",
"the",
"current",
"time",
"as",
"determined",
"by",
"the",
"passed",
"clock",
"to",
"the",
"passed",
"attributes",
"dictionary",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L217-L219 |
113,029 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.convertToFilePath | public static String convertToFilePath(String objectName) {
if (!Strings.isNullOrEmpty(objectName)) {
if (objectHasDirectoryPath(objectName)) {
objectName = objectName.substring(0, objectName.length() - 1);
}
}
return objectName;
} | java | public static String convertToFilePath(String objectName) {
if (!Strings.isNullOrEmpty(objectName)) {
if (objectHasDirectoryPath(objectName)) {
objectName = objectName.substring(0, objectName.length() - 1);
}
}
return objectName;
} | [
"public",
"static",
"String",
"convertToFilePath",
"(",
"String",
"objectName",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"objectName",
")",
")",
"{",
"if",
"(",
"objectHasDirectoryPath",
"(",
"objectName",
")",
")",
"{",
"objectName",
... | Converts the given object name to look like a file path.
If the object name already looks like a file path then
this call is a no-op.
If the object name is null or empty, it is returned as-is.
@param objectName Name of the object to inspect.
@return File path for the given path. | [
"Converts",
"the",
"given",
"object",
"name",
"to",
"look",
"like",
"a",
"file",
"path",
".",
"If",
"the",
"object",
"name",
"already",
"looks",
"like",
"a",
"file",
"path",
"then",
"this",
"call",
"is",
"a",
"no",
"-",
"op",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L231-L238 |
113,030 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.fromItemInfo | public static FileInfo fromItemInfo(PathCodec pathCodec, GoogleCloudStorageItemInfo itemInfo) {
if (itemInfo.isRoot()) {
return ROOT_INFO;
}
URI path = pathCodec.getPath(itemInfo.getBucketName(), itemInfo.getObjectName(), true);
return new FileInfo(path, itemInfo);
} | java | public static FileInfo fromItemInfo(PathCodec pathCodec, GoogleCloudStorageItemInfo itemInfo) {
if (itemInfo.isRoot()) {
return ROOT_INFO;
}
URI path = pathCodec.getPath(itemInfo.getBucketName(), itemInfo.getObjectName(), true);
return new FileInfo(path, itemInfo);
} | [
"public",
"static",
"FileInfo",
"fromItemInfo",
"(",
"PathCodec",
"pathCodec",
",",
"GoogleCloudStorageItemInfo",
"itemInfo",
")",
"{",
"if",
"(",
"itemInfo",
".",
"isRoot",
"(",
")",
")",
"{",
"return",
"ROOT_INFO",
";",
"}",
"URI",
"path",
"=",
"pathCodec",
... | Handy factory method for constructing a FileInfo from a GoogleCloudStorageItemInfo while
potentially returning a singleton instead of really constructing an object for cases like ROOT. | [
"Handy",
"factory",
"method",
"for",
"constructing",
"a",
"FileInfo",
"from",
"a",
"GoogleCloudStorageItemInfo",
"while",
"potentially",
"returning",
"a",
"singleton",
"instead",
"of",
"really",
"constructing",
"an",
"object",
"for",
"cases",
"like",
"ROOT",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L244-L250 |
113,031 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.fromItemInfos | public static List<FileInfo> fromItemInfos(
PathCodec pathCodec, List<GoogleCloudStorageItemInfo> itemInfos) {
List<FileInfo> fileInfos = new ArrayList<>(itemInfos.size());
for (GoogleCloudStorageItemInfo itemInfo : itemInfos) {
fileInfos.add(fromItemInfo(pathCodec, itemInfo));
}
return file... | java | public static List<FileInfo> fromItemInfos(
PathCodec pathCodec, List<GoogleCloudStorageItemInfo> itemInfos) {
List<FileInfo> fileInfos = new ArrayList<>(itemInfos.size());
for (GoogleCloudStorageItemInfo itemInfo : itemInfos) {
fileInfos.add(fromItemInfo(pathCodec, itemInfo));
}
return file... | [
"public",
"static",
"List",
"<",
"FileInfo",
">",
"fromItemInfos",
"(",
"PathCodec",
"pathCodec",
",",
"List",
"<",
"GoogleCloudStorageItemInfo",
">",
"itemInfos",
")",
"{",
"List",
"<",
"FileInfo",
">",
"fileInfos",
"=",
"new",
"ArrayList",
"<>",
"(",
"itemIn... | Handy factory method for constructing a list of FileInfo from a list of
GoogleCloudStorageItemInfo. | [
"Handy",
"factory",
"method",
"for",
"constructing",
"a",
"list",
"of",
"FileInfo",
"from",
"a",
"list",
"of",
"GoogleCloudStorageItemInfo",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L256-L263 |
113,032 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.isDirectoryPath | public static boolean isDirectoryPath(URI path) {
return (path != null) && path.toString().endsWith(GoogleCloudStorage.PATH_DELIMITER);
} | java | public static boolean isDirectoryPath(URI path) {
return (path != null) && path.toString().endsWith(GoogleCloudStorage.PATH_DELIMITER);
} | [
"public",
"static",
"boolean",
"isDirectoryPath",
"(",
"URI",
"path",
")",
"{",
"return",
"(",
"path",
"!=",
"null",
")",
"&&",
"path",
".",
"toString",
"(",
")",
".",
"endsWith",
"(",
"GoogleCloudStorage",
".",
"PATH_DELIMITER",
")",
";",
"}"
] | Indicates whether the given path looks like a directory path.
@param path Path to inspect.
@return Whether the path looks like a directory path. | [
"Indicates",
"whether",
"the",
"given",
"path",
"looks",
"like",
"a",
"directory",
"path",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L271-L273 |
113,033 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.convertToDirectoryPath | public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId) {
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = new StorageResourceId(
resourceId.getBucketName(), convertToDirectoryPath(resourceId.getObjectN... | java | public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId) {
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = new StorageResourceId(
resourceId.getBucketName(), convertToDirectoryPath(resourceId.getObjectN... | [
"public",
"static",
"StorageResourceId",
"convertToDirectoryPath",
"(",
"StorageResourceId",
"resourceId",
")",
"{",
"if",
"(",
"resourceId",
".",
"isStorageObject",
"(",
")",
")",
"{",
"if",
"(",
"!",
"objectHasDirectoryPath",
"(",
"resourceId",
".",
"getObjectName... | Converts the given resourceId to look like a directory path.
If the path already looks like a directory path then
this call is a no-op.
@param resourceId StorageResourceId to convert.
@return A resourceId with a directory path corresponding to the given resourceId. | [
"Converts",
"the",
"given",
"resourceId",
"to",
"look",
"like",
"a",
"directory",
"path",
".",
"If",
"the",
"path",
"already",
"looks",
"like",
"a",
"directory",
"path",
"then",
"this",
"call",
"is",
"a",
"no",
"-",
"op",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L283-L291 |
113,034 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.convertToDirectoryPath | public static URI convertToDirectoryPath(PathCodec pathCodec, URI path) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = convertToDirectoryPath(resourceId);
... | java | public static URI convertToDirectoryPath(PathCodec pathCodec, URI path) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = convertToDirectoryPath(resourceId);
... | [
"public",
"static",
"URI",
"convertToDirectoryPath",
"(",
"PathCodec",
"pathCodec",
",",
"URI",
"path",
")",
"{",
"StorageResourceId",
"resourceId",
"=",
"pathCodec",
".",
"validatePathAndGetId",
"(",
"path",
",",
"true",
")",
";",
"if",
"(",
"resourceId",
".",
... | Converts the given path to look like a directory path.
If the path already looks like a directory path then
this call is a no-op.
@param path Path to convert.
@return Directory path for the given path. | [
"Converts",
"the",
"given",
"path",
"to",
"look",
"like",
"a",
"directory",
"path",
".",
"If",
"the",
"path",
"already",
"looks",
"like",
"a",
"directory",
"path",
"then",
"this",
"call",
"is",
"a",
"no",
"-",
"op",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L301-L312 |
113,035 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryTableHelper.java | BigQueryTableHelper.getTableFieldsJson | static String getTableFieldsJson(TableSchema tableSchema) throws IOException {
return JacksonFactory.getDefaultInstance().toString(tableSchema.getFields());
} | java | static String getTableFieldsJson(TableSchema tableSchema) throws IOException {
return JacksonFactory.getDefaultInstance().toString(tableSchema.getFields());
} | [
"static",
"String",
"getTableFieldsJson",
"(",
"TableSchema",
"tableSchema",
")",
"throws",
"IOException",
"{",
"return",
"JacksonFactory",
".",
"getDefaultInstance",
"(",
")",
".",
"toString",
"(",
"tableSchema",
".",
"getFields",
"(",
")",
")",
";",
"}"
] | Gets the JSON representation of the table's fields.
@param tableSchema {@link TableSchema} to get JSON fields from
@return the JSON of the fields.
@throws IOException | [
"Gets",
"the",
"JSON",
"representation",
"of",
"the",
"table",
"s",
"fields",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryTableHelper.java#L71-L73 |
113,036 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/GsonRecordReader.java | GsonRecordReader.initialize | @Override
public void initialize(InputSplit genericSplit, TaskAttemptContext context)
throws IOException {
if (logger.atFine().isEnabled()) {
try {
logger.atFine().log(
"initialize('%s', '%s')",
HadoopToStringUtil.toString(genericSplit), HadoopToStringUtil.toString(cont... | java | @Override
public void initialize(InputSplit genericSplit, TaskAttemptContext context)
throws IOException {
if (logger.atFine().isEnabled()) {
try {
logger.atFine().log(
"initialize('%s', '%s')",
HadoopToStringUtil.toString(genericSplit), HadoopToStringUtil.toString(cont... | [
"@",
"Override",
"public",
"void",
"initialize",
"(",
"InputSplit",
"genericSplit",
",",
"TaskAttemptContext",
"context",
")",
"throws",
"IOException",
"{",
"if",
"(",
"logger",
".",
"atFine",
"(",
")",
".",
"isEnabled",
"(",
")",
")",
"{",
"try",
"{",
"lo... | Called once at initialization to initialize the RecordReader.
@param genericSplit the split that defines the range of records to read.
@param context the information about the task.
@throws IOException on IO Error. | [
"Called",
"once",
"at",
"initialization",
"to",
"initialize",
"the",
"RecordReader",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/GsonRecordReader.java#L62-L84 |
113,037 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/GsonRecordReader.java | GsonRecordReader.nextKeyValue | @Override
public boolean nextKeyValue()
throws IOException {
// If there is no next value, return false. Set current key and value to null.
// Different Hadoop recordreaders have different behavior for calling current key and value
// after nextKeyValue returns false.
if (!lineReader.nextKeyValu... | java | @Override
public boolean nextKeyValue()
throws IOException {
// If there is no next value, return false. Set current key and value to null.
// Different Hadoop recordreaders have different behavior for calling current key and value
// after nextKeyValue returns false.
if (!lineReader.nextKeyValu... | [
"@",
"Override",
"public",
"boolean",
"nextKeyValue",
"(",
")",
"throws",
"IOException",
"{",
"// If there is no next value, return false. Set current key and value to null.",
"// Different Hadoop recordreaders have different behavior for calling current key and value",
"// after nextKeyValu... | Reads the next key, value pair. Gets next line and parses Json object.
@return true if a key/value pair was read.
@throws IOException on IO Error. | [
"Reads",
"the",
"next",
"key",
"value",
"pair",
".",
"Gets",
"next",
"line",
"and",
"parses",
"Json",
"object",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/GsonRecordReader.java#L92-L109 |
113,038 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageItemInfo.java | GoogleCloudStorageItemInfo.createInferredDirectory | public static GoogleCloudStorageItemInfo createInferredDirectory(StorageResourceId resourceId) {
checkArgument(resourceId != null, "resourceId must not be null");
return new GoogleCloudStorageItemInfo(
resourceId,
/* creationTime= */ 0,
/* size= */ 0,
/* location= */ null,
... | java | public static GoogleCloudStorageItemInfo createInferredDirectory(StorageResourceId resourceId) {
checkArgument(resourceId != null, "resourceId must not be null");
return new GoogleCloudStorageItemInfo(
resourceId,
/* creationTime= */ 0,
/* size= */ 0,
/* location= */ null,
... | [
"public",
"static",
"GoogleCloudStorageItemInfo",
"createInferredDirectory",
"(",
"StorageResourceId",
"resourceId",
")",
"{",
"checkArgument",
"(",
"resourceId",
"!=",
"null",
",",
"\"resourceId must not be null\"",
")",
";",
"return",
"new",
"GoogleCloudStorageItemInfo",
... | Helper for creating a "found" GoogleCloudStorageItemInfo for an inferred directory. | [
"Helper",
"for",
"creating",
"a",
"found",
"GoogleCloudStorageItemInfo",
"for",
"an",
"inferred",
"directory",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageItemInfo.java#L47-L55 |
113,039 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageItemInfo.java | GoogleCloudStorageItemInfo.createNotFound | public static GoogleCloudStorageItemInfo createNotFound(StorageResourceId resourceId) {
checkArgument(resourceId != null, "resourceId must not be null");
// Bucket or StorageObject.
return new GoogleCloudStorageItemInfo(
resourceId,
/* creationTime= */ 0,
/* size= */ -1,
/* l... | java | public static GoogleCloudStorageItemInfo createNotFound(StorageResourceId resourceId) {
checkArgument(resourceId != null, "resourceId must not be null");
// Bucket or StorageObject.
return new GoogleCloudStorageItemInfo(
resourceId,
/* creationTime= */ 0,
/* size= */ -1,
/* l... | [
"public",
"static",
"GoogleCloudStorageItemInfo",
"createNotFound",
"(",
"StorageResourceId",
"resourceId",
")",
"{",
"checkArgument",
"(",
"resourceId",
"!=",
"null",
",",
"\"resourceId must not be null\"",
")",
";",
"// Bucket or StorageObject.",
"return",
"new",
"GoogleC... | Helper for creating a "not found" GoogleCloudStorageItemInfo for a StorageResourceId. | [
"Helper",
"for",
"creating",
"a",
"not",
"found",
"GoogleCloudStorageItemInfo",
"for",
"a",
"StorageResourceId",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageItemInfo.java#L58-L67 |
113,040 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java | ForwardingBigQueryFileOutputFormat.checkOutputSpecs | @Override
public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException, IOException {
Configuration conf = job.getConfiguration();
// Validate the output configuration.
BigQueryOutputConfiguration.validateConfiguration(conf);
// Get the output path.
Path outputPath = BigQueryOu... | java | @Override
public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException, IOException {
Configuration conf = job.getConfiguration();
// Validate the output configuration.
BigQueryOutputConfiguration.validateConfiguration(conf);
// Get the output path.
Path outputPath = BigQueryOu... | [
"@",
"Override",
"public",
"void",
"checkOutputSpecs",
"(",
"JobContext",
"job",
")",
"throws",
"FileAlreadyExistsException",
",",
"IOException",
"{",
"Configuration",
"conf",
"=",
"job",
".",
"getConfiguration",
"(",
")",
";",
"// Validate the output configuration.",
... | Checks to make sure the configuration is valid, the output path doesn't already exist, and that
a connection to BigQuery can be established. | [
"Checks",
"to",
"make",
"sure",
"the",
"configuration",
"is",
"valid",
"the",
"output",
"path",
"doesn",
"t",
"already",
"exist",
"and",
"that",
"a",
"connection",
"to",
"BigQuery",
"can",
"be",
"established",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java#L58-L89 |
113,041 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java | ForwardingBigQueryFileOutputFormat.getOutputCommitter | @Override
public synchronized OutputCommitter getOutputCommitter(TaskAttemptContext context)
throws IOException {
// Cache the committer.
if (committer == null) {
committer = createCommitter(context);
}
return committer;
} | java | @Override
public synchronized OutputCommitter getOutputCommitter(TaskAttemptContext context)
throws IOException {
// Cache the committer.
if (committer == null) {
committer = createCommitter(context);
}
return committer;
} | [
"@",
"Override",
"public",
"synchronized",
"OutputCommitter",
"getOutputCommitter",
"(",
"TaskAttemptContext",
"context",
")",
"throws",
"IOException",
"{",
"// Cache the committer.",
"if",
"(",
"committer",
"==",
"null",
")",
"{",
"committer",
"=",
"createCommitter",
... | Gets the cached OutputCommitter, creating a new one if it doesn't exist. | [
"Gets",
"the",
"cached",
"OutputCommitter",
"creating",
"a",
"new",
"one",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java#L92-L100 |
113,042 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java | ForwardingBigQueryFileOutputFormat.getRecordWriter | @Override
public RecordWriter<K, V> getRecordWriter(TaskAttemptContext context)
throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
return getDelegate(conf).getRecordWriter(context);
} | java | @Override
public RecordWriter<K, V> getRecordWriter(TaskAttemptContext context)
throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
return getDelegate(conf).getRecordWriter(context);
} | [
"@",
"Override",
"public",
"RecordWriter",
"<",
"K",
",",
"V",
">",
"getRecordWriter",
"(",
"TaskAttemptContext",
"context",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Configuration",
"conf",
"=",
"context",
".",
"getConfiguration",
"(",
")",... | Gets the RecordWriter from the wrapped FileOutputFormat. | [
"Gets",
"the",
"RecordWriter",
"from",
"the",
"wrapped",
"FileOutputFormat",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java#L103-L108 |
113,043 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java | ForwardingBigQueryFileOutputFormat.createCommitter | protected OutputCommitter createCommitter(TaskAttemptContext context) throws IOException {
Configuration conf = context.getConfiguration();
return getDelegate(conf).getOutputCommitter(context);
} | java | protected OutputCommitter createCommitter(TaskAttemptContext context) throws IOException {
Configuration conf = context.getConfiguration();
return getDelegate(conf).getOutputCommitter(context);
} | [
"protected",
"OutputCommitter",
"createCommitter",
"(",
"TaskAttemptContext",
"context",
")",
"throws",
"IOException",
"{",
"Configuration",
"conf",
"=",
"context",
".",
"getConfiguration",
"(",
")",
";",
"return",
"getDelegate",
"(",
"conf",
")",
".",
"getOutputCom... | Create a new OutputCommitter for this OutputFormat.
@param context the context to create the OutputCommitter from.
@return the new OutputCommitter for this format.
@throws IOException if there's an issue while creating the OutputCommitter. | [
"Create",
"a",
"new",
"OutputCommitter",
"for",
"this",
"OutputFormat",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java#L117-L120 |
113,044 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java | ForwardingBigQueryFileOutputFormat.getDelegate | @SuppressWarnings("unchecked")
protected synchronized FileOutputFormat<K, V> getDelegate(Configuration conf) throws IOException {
if (delegate == null) {
delegate = BigQueryOutputConfiguration.getFileOutputFormat(conf);
logger.atInfo().log("Delegating functionality to '%s'.", delegate.getClass().getSi... | java | @SuppressWarnings("unchecked")
protected synchronized FileOutputFormat<K, V> getDelegate(Configuration conf) throws IOException {
if (delegate == null) {
delegate = BigQueryOutputConfiguration.getFileOutputFormat(conf);
logger.atInfo().log("Delegating functionality to '%s'.", delegate.getClass().getSi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"synchronized",
"FileOutputFormat",
"<",
"K",
",",
"V",
">",
"getDelegate",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"delegate",
"==",
"null",
")",
"{",
"delega... | Gets a reference to the underlying delegate used by this OutputFormat.
@param conf the configuration to derive the delegate from.
@return the underlying wrapped delegate.
@throws IOException if unable to get the delegate. | [
"Gets",
"a",
"reference",
"to",
"the",
"underlying",
"delegate",
"used",
"by",
"this",
"OutputFormat",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java#L129-L136 |
113,045 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java | BigQueryOutputConfiguration.validateConfiguration | public static void validateConfiguration(Configuration conf) throws IOException {
// Ensure the BigQuery output information is valid.
ConfigurationUtil.getMandatoryConfig(conf, REQUIRED_KEYS);
// Run through the individual getters as they manage error handling.
getProjectId(conf);
getTableSchema(co... | java | public static void validateConfiguration(Configuration conf) throws IOException {
// Ensure the BigQuery output information is valid.
ConfigurationUtil.getMandatoryConfig(conf, REQUIRED_KEYS);
// Run through the individual getters as they manage error handling.
getProjectId(conf);
getTableSchema(co... | [
"public",
"static",
"void",
"validateConfiguration",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"// Ensure the BigQuery output information is valid.",
"ConfigurationUtil",
".",
"getMandatoryConfig",
"(",
"conf",
",",
"REQUIRED_KEYS",
")",
";",
"// Run ... | Helper function that validates the output configuration. Ensures the project id, dataset id,
and table id exist in the configuration. This also ensures that if a schema is provided, that
it is properly formatted.
@param conf the configuration to validate.
@throws IOException if the configuration is missing a key, or t... | [
"Helper",
"function",
"that",
"validates",
"the",
"output",
"configuration",
".",
"Ensures",
"the",
"project",
"id",
"dataset",
"id",
"and",
"table",
"id",
"exist",
"in",
"the",
"configuration",
".",
"This",
"also",
"ensures",
"that",
"if",
"a",
"schema",
"i... | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java#L232-L242 |
113,046 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java | BigQueryOutputConfiguration.getTableSchema | static Optional<BigQueryTableSchema> getTableSchema(Configuration conf) throws IOException {
String fieldsJson = conf.get(BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY);
if (!Strings.isNullOrEmpty(fieldsJson)) {
try {
TableSchema tableSchema = BigQueryTableHelper.createTableSchemaFromFields(fields... | java | static Optional<BigQueryTableSchema> getTableSchema(Configuration conf) throws IOException {
String fieldsJson = conf.get(BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY);
if (!Strings.isNullOrEmpty(fieldsJson)) {
try {
TableSchema tableSchema = BigQueryTableHelper.createTableSchemaFromFields(fields... | [
"static",
"Optional",
"<",
"BigQueryTableSchema",
">",
"getTableSchema",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"fieldsJson",
"=",
"conf",
".",
"get",
"(",
"BigQueryConfiguration",
".",
"OUTPUT_TABLE_SCHEMA_KEY",
")",
";",
"if",
... | Gets the output table schema based on the given configuration.
@param conf the configuration to reference the keys from.
@return the derived table schema, absent value if no table schema exists in the configuration.
@throws IOException if a table schema was set in the configuration but couldn't be parsed. | [
"Gets",
"the",
"output",
"table",
"schema",
"based",
"on",
"the",
"given",
"configuration",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java#L304-L316 |
113,047 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java | BigQueryOutputConfiguration.getGcsOutputPath | public static Path getGcsOutputPath(Configuration conf) throws IOException {
Job tempJob = new JobConfigurationAdapter(conf);
// Error if the output path is missing.
Path outputPath = FileOutputFormat.getOutputPath(tempJob);
if (outputPath == null) {
throw new IOException("FileOutputFormat output... | java | public static Path getGcsOutputPath(Configuration conf) throws IOException {
Job tempJob = new JobConfigurationAdapter(conf);
// Error if the output path is missing.
Path outputPath = FileOutputFormat.getOutputPath(tempJob);
if (outputPath == null) {
throw new IOException("FileOutputFormat output... | [
"public",
"static",
"Path",
"getGcsOutputPath",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"Job",
"tempJob",
"=",
"new",
"JobConfigurationAdapter",
"(",
"conf",
")",
";",
"// Error if the output path is missing.",
"Path",
"outputPath",
"=",
"File... | Gets the stored GCS output path in the configuration.
@param conf the configuration to reference the keys from.
@return the stored output path in the configuration.
@throws IOException if the output path isn't set in the configuration, or the output path's
file system isn't derived from GoogleHadoopFileSystemBase. | [
"Gets",
"the",
"stored",
"GCS",
"output",
"path",
"in",
"the",
"configuration",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java#L384-L400 |
113,048 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java | BigQueryOutputConfiguration.getWriteDisposition | public static String getWriteDisposition(Configuration conf) {
return conf.get(
BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION_KEY,
BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION_DEFAULT);
} | java | public static String getWriteDisposition(Configuration conf) {
return conf.get(
BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION_KEY,
BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION_DEFAULT);
} | [
"public",
"static",
"String",
"getWriteDisposition",
"(",
"Configuration",
"conf",
")",
"{",
"return",
"conf",
".",
"get",
"(",
"BigQueryConfiguration",
".",
"OUTPUT_TABLE_WRITE_DISPOSITION_KEY",
",",
"BigQueryConfiguration",
".",
"OUTPUT_TABLE_WRITE_DISPOSITION_DEFAULT",
"... | Gets the write disposition of the output table. This specifies the action that occurs if the
destination table already exists. By default, if the table already exists, BigQuery appends
data to the output table.
@param conf the configuration to reference the keys from.
@return the write disposition of the output table. | [
"Gets",
"the",
"write",
"disposition",
"of",
"the",
"output",
"table",
".",
"This",
"specifies",
"the",
"action",
"that",
"occurs",
"if",
"the",
"destination",
"table",
"already",
"exists",
".",
"By",
"default",
"if",
"the",
"table",
"already",
"exists",
"Bi... | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java#L410-L414 |
113,049 | GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java | BigQueryOutputConfiguration.setFileOutputFormatOutputPath | @VisibleForTesting
static void setFileOutputFormatOutputPath(Configuration conf, String outputPath)
throws IOException {
Job tempJob = new JobConfigurationAdapter(conf);
FileOutputFormat.setOutputPath(tempJob, new Path(outputPath));
} | java | @VisibleForTesting
static void setFileOutputFormatOutputPath(Configuration conf, String outputPath)
throws IOException {
Job tempJob = new JobConfigurationAdapter(conf);
FileOutputFormat.setOutputPath(tempJob, new Path(outputPath));
} | [
"@",
"VisibleForTesting",
"static",
"void",
"setFileOutputFormatOutputPath",
"(",
"Configuration",
"conf",
",",
"String",
"outputPath",
")",
"throws",
"IOException",
"{",
"Job",
"tempJob",
"=",
"new",
"JobConfigurationAdapter",
"(",
"conf",
")",
";",
"FileOutputFormat... | Sets the output path for FileOutputFormat.
@param conf the configuration to pass to FileOutputFormat.
@param outputPath the path to set as the output path.
@throws IOException | [
"Sets",
"the",
"output",
"path",
"for",
"FileOutputFormat",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/BigQueryOutputConfiguration.java#L423-L428 |
113,050 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.accessDeniedNonRecoverable | public boolean accessDeniedNonRecoverable(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return ACCOUNT_DISABLED_REASON_CODE.equals(reason)
|| ACCESS_NOT_CONFIGURED_REASON_CODE.equals(reason);
}
return fal... | java | public boolean accessDeniedNonRecoverable(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return ACCOUNT_DISABLED_REASON_CODE.equals(reason)
|| ACCESS_NOT_CONFIGURED_REASON_CODE.equals(reason);
}
return fal... | [
"public",
"boolean",
"accessDeniedNonRecoverable",
"(",
"GoogleJsonError",
"e",
")",
"{",
"ErrorInfo",
"errorInfo",
"=",
"getErrorInfo",
"(",
"e",
")",
";",
"if",
"(",
"errorInfo",
"!=",
"null",
")",
"{",
"String",
"reason",
"=",
"errorInfo",
".",
"getReason",... | Determine if a given GoogleJsonError is caused by, and only by,
account disabled error. | [
"Determine",
"if",
"a",
"given",
"GoogleJsonError",
"is",
"caused",
"by",
"and",
"only",
"by",
"account",
"disabled",
"error",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L122-L130 |
113,051 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.isClientError | public boolean isClientError(IOException e) {
GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e);
if (jsonException != null) {
return (getHttpStatusCode(jsonException)) / 100 == 4;
}
return false;
} | java | public boolean isClientError(IOException e) {
GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e);
if (jsonException != null) {
return (getHttpStatusCode(jsonException)) / 100 == 4;
}
return false;
} | [
"public",
"boolean",
"isClientError",
"(",
"IOException",
"e",
")",
"{",
"GoogleJsonResponseException",
"jsonException",
"=",
"getJsonResponseExceptionOrNull",
"(",
"e",
")",
";",
"if",
"(",
"jsonException",
"!=",
"null",
")",
"{",
"return",
"(",
"getHttpStatusCode"... | Determines if the exception is a client error. | [
"Determines",
"if",
"the",
"exception",
"is",
"a",
"client",
"error",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L135-L141 |
113,052 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.fieldSizeTooLarge | public boolean fieldSizeTooLarge(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return FIELD_SIZE_TOO_LARGE.equals(reason);
}
return false;
} | java | public boolean fieldSizeTooLarge(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return FIELD_SIZE_TOO_LARGE.equals(reason);
}
return false;
} | [
"public",
"boolean",
"fieldSizeTooLarge",
"(",
"GoogleJsonError",
"e",
")",
"{",
"ErrorInfo",
"errorInfo",
"=",
"getErrorInfo",
"(",
"e",
")",
";",
"if",
"(",
"errorInfo",
"!=",
"null",
")",
"{",
"String",
"reason",
"=",
"errorInfo",
".",
"getReason",
"(",
... | Determines if the given GoogleJsonError indicates 'field size too large'. | [
"Determines",
"if",
"the",
"given",
"GoogleJsonError",
"indicates",
"field",
"size",
"too",
"large",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L182-L189 |
113,053 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.resourceNotReady | public boolean resourceNotReady(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return RESOURCE_NOT_READY_REASON_CODE.equals(reason);
}
return false;
} | java | public boolean resourceNotReady(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return RESOURCE_NOT_READY_REASON_CODE.equals(reason);
}
return false;
} | [
"public",
"boolean",
"resourceNotReady",
"(",
"GoogleJsonError",
"e",
")",
"{",
"ErrorInfo",
"errorInfo",
"=",
"getErrorInfo",
"(",
"e",
")",
";",
"if",
"(",
"errorInfo",
"!=",
"null",
")",
"{",
"String",
"reason",
"=",
"errorInfo",
".",
"getReason",
"(",
... | Determines if the given GoogleJsonError indicates 'resource not ready'. | [
"Determines",
"if",
"the",
"given",
"GoogleJsonError",
"indicates",
"resource",
"not",
"ready",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L207-L214 |
113,054 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.rateLimited | public boolean rateLimited(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String domain = errorInfo.getDomain();
String reason = errorInfo.getReason();
boolean isRateLimitedOrGlobalDomain =
USAGE_LIMITS_DOMAIN.equals(domain) || GLOBAL_DOMAIN.equa... | java | public boolean rateLimited(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String domain = errorInfo.getDomain();
String reason = errorInfo.getReason();
boolean isRateLimitedOrGlobalDomain =
USAGE_LIMITS_DOMAIN.equals(domain) || GLOBAL_DOMAIN.equa... | [
"public",
"boolean",
"rateLimited",
"(",
"GoogleJsonError",
"e",
")",
"{",
"ErrorInfo",
"errorInfo",
"=",
"getErrorInfo",
"(",
"e",
")",
";",
"if",
"(",
"errorInfo",
"!=",
"null",
")",
"{",
"String",
"domain",
"=",
"errorInfo",
".",
"getDomain",
"(",
")",
... | Determine if a given GoogleJsonError is caused by, and only by,
a rate limit being applied.
@param e The GoogleJsonError returned by the request
@return True if the error is caused by a rate limit being applied. | [
"Determine",
"if",
"a",
"given",
"GoogleJsonError",
"is",
"caused",
"by",
"and",
"only",
"by",
"a",
"rate",
"limit",
"being",
"applied",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L260-L272 |
113,055 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.userProjectMissing | public boolean userProjectMissing(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
return errorInfo != null
&& e.getCode() == STATUS_CODE_BAD_REQUEST
&& USER_PROJECT_MISSING.equals(errorInfo.getMessage());
} | java | public boolean userProjectMissing(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
return errorInfo != null
&& e.getCode() == STATUS_CODE_BAD_REQUEST
&& USER_PROJECT_MISSING.equals(errorInfo.getMessage());
} | [
"public",
"boolean",
"userProjectMissing",
"(",
"GoogleJsonError",
"e",
")",
"{",
"ErrorInfo",
"errorInfo",
"=",
"getErrorInfo",
"(",
"e",
")",
";",
"return",
"errorInfo",
"!=",
"null",
"&&",
"e",
".",
"getCode",
"(",
")",
"==",
"STATUS_CODE_BAD_REQUEST",
"&&"... | Determines if the given GoogleJsonError indicates that 'userProject' is missing in request | [
"Determines",
"if",
"the",
"given",
"GoogleJsonError",
"indicates",
"that",
"userProject",
"is",
"missing",
"in",
"request"
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L291-L296 |
113,056 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.getErrorMessage | public String getErrorMessage(IOException e) {
// Prefer to use message from GJRE.
GoogleJsonResponseException gjre = getJsonResponseExceptionOrNull(e);
if (gjre != null && gjre.getDetails() != null) {
return gjre.getDetails().getMessage();
}
return e.getMessage();
} | java | public String getErrorMessage(IOException e) {
// Prefer to use message from GJRE.
GoogleJsonResponseException gjre = getJsonResponseExceptionOrNull(e);
if (gjre != null && gjre.getDetails() != null) {
return gjre.getDetails().getMessage();
}
return e.getMessage();
} | [
"public",
"String",
"getErrorMessage",
"(",
"IOException",
"e",
")",
"{",
"// Prefer to use message from GJRE.",
"GoogleJsonResponseException",
"gjre",
"=",
"getJsonResponseExceptionOrNull",
"(",
"e",
")",
";",
"if",
"(",
"gjre",
"!=",
"null",
"&&",
"gjre",
".",
"ge... | Extracts the error message. | [
"Extracts",
"the",
"error",
"message",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L354-L362 |
113,057 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.getErrorInfo | protected ErrorInfo getErrorInfo(IOException e) {
GoogleJsonError gjre = getDetails(e);
if (gjre != null) {
return getErrorInfo(gjre);
}
return null;
} | java | protected ErrorInfo getErrorInfo(IOException e) {
GoogleJsonError gjre = getDetails(e);
if (gjre != null) {
return getErrorInfo(gjre);
}
return null;
} | [
"protected",
"ErrorInfo",
"getErrorInfo",
"(",
"IOException",
"e",
")",
"{",
"GoogleJsonError",
"gjre",
"=",
"getDetails",
"(",
"e",
")",
";",
"if",
"(",
"gjre",
"!=",
"null",
")",
"{",
"return",
"getErrorInfo",
"(",
"gjre",
")",
";",
"}",
"return",
"nul... | Get the first ErrorInfo from an IOException if it is an instance of
GoogleJsonResponseException, otherwise return null. | [
"Get",
"the",
"first",
"ErrorInfo",
"from",
"an",
"IOException",
"if",
"it",
"is",
"an",
"instance",
"of",
"GoogleJsonResponseException",
"otherwise",
"return",
"null",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L428-L434 |
113,058 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.getDetails | protected GoogleJsonError getDetails(IOException e) {
if (e instanceof GoogleJsonResponseException) {
return ((GoogleJsonResponseException) e).getDetails();
}
return null;
} | java | protected GoogleJsonError getDetails(IOException e) {
if (e instanceof GoogleJsonResponseException) {
return ((GoogleJsonResponseException) e).getDetails();
}
return null;
} | [
"protected",
"GoogleJsonError",
"getDetails",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"GoogleJsonResponseException",
")",
"{",
"return",
"(",
"(",
"GoogleJsonResponseException",
")",
"e",
")",
".",
"getDetails",
"(",
")",
";",
"}",
"re... | If the exception is a GoogleJsonResponseException, get the
error details, else return null. | [
"If",
"the",
"exception",
"is",
"a",
"GoogleJsonResponseException",
"get",
"the",
"error",
"details",
"else",
"return",
"null",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L440-L445 |
113,059 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java | ApiErrorExtractor.getErrorInfo | protected ErrorInfo getErrorInfo(GoogleJsonError details) {
if (details == null) {
return null;
}
List<ErrorInfo> errors = details.getErrors();
return errors.isEmpty() ? null : errors.get(0);
} | java | protected ErrorInfo getErrorInfo(GoogleJsonError details) {
if (details == null) {
return null;
}
List<ErrorInfo> errors = details.getErrors();
return errors.isEmpty() ? null : errors.get(0);
} | [
"protected",
"ErrorInfo",
"getErrorInfo",
"(",
"GoogleJsonError",
"details",
")",
"{",
"if",
"(",
"details",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"ErrorInfo",
">",
"errors",
"=",
"details",
".",
"getErrors",
"(",
")",
";",
"re... | Get the first ErrorInfo from a GoogleJsonError, or null if
there is not one. | [
"Get",
"the",
"first",
"ErrorInfo",
"from",
"a",
"GoogleJsonError",
"or",
"null",
"if",
"there",
"is",
"not",
"one",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L451-L457 |
113,060 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/EntriesCredentialConfiguration.java | EntriesCredentialConfiguration.getConfigurationInto | public void getConfigurationInto(Entries configuration) {
for (String prefix : prefixes) {
configuration.setBoolean(prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX, isServiceAccountEnabled());
if (getServiceAccountEmail() != null) {
configuration.set(prefix + SERVICE_ACCOUNT_EMAIL_SUFFIX, getServiceAcco... | java | public void getConfigurationInto(Entries configuration) {
for (String prefix : prefixes) {
configuration.setBoolean(prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX, isServiceAccountEnabled());
if (getServiceAccountEmail() != null) {
configuration.set(prefix + SERVICE_ACCOUNT_EMAIL_SUFFIX, getServiceAcco... | [
"public",
"void",
"getConfigurationInto",
"(",
"Entries",
"configuration",
")",
"{",
"for",
"(",
"String",
"prefix",
":",
"prefixes",
")",
"{",
"configuration",
".",
"setBoolean",
"(",
"prefix",
"+",
"ENABLE_SERVICE_ACCOUNTS_SUFFIX",
",",
"isServiceAccountEnabled",
... | Gets our parameters and fills it into the specified configuration.
Typically the passed-in configuration is an empty
instance of a configuration object that extends Entries. | [
"Gets",
"our",
"parameters",
"and",
"fills",
"it",
"into",
"the",
"specified",
"configuration",
".",
"Typically",
"the",
"passed",
"-",
"in",
"configuration",
"is",
"an",
"empty",
"instance",
"of",
"a",
"configuration",
"object",
"that",
"extends",
"Entries",
... | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/EntriesCredentialConfiguration.java#L237-L280 |
113,061 | GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/EntriesCredentialConfiguration.java | EntriesCredentialConfiguration.setConfiguration | public void setConfiguration(Entries entries) {
for (String prefix : prefixes) {
Optional<Boolean> enableServiceAccounts =
maybeGetBoolean(entries, prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX);
if (enableServiceAccounts.isPresent()) {
setEnableServiceAccounts(enableServiceAccounts.get());... | java | public void setConfiguration(Entries entries) {
for (String prefix : prefixes) {
Optional<Boolean> enableServiceAccounts =
maybeGetBoolean(entries, prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX);
if (enableServiceAccounts.isPresent()) {
setEnableServiceAccounts(enableServiceAccounts.get());... | [
"public",
"void",
"setConfiguration",
"(",
"Entries",
"entries",
")",
"{",
"for",
"(",
"String",
"prefix",
":",
"prefixes",
")",
"{",
"Optional",
"<",
"Boolean",
">",
"enableServiceAccounts",
"=",
"maybeGetBoolean",
"(",
"entries",
",",
"prefix",
"+",
"ENABLE_... | Load configuration values from the provided configuration source. For any key that does not
have a corresponding value in the configuration, no changes will be made to the state of this
object. | [
"Load",
"configuration",
"values",
"from",
"the",
"provided",
"configuration",
"source",
".",
"For",
"any",
"key",
"that",
"does",
"not",
"have",
"a",
"corresponding",
"value",
"in",
"the",
"configuration",
"no",
"changes",
"will",
"be",
"made",
"to",
"the",
... | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/EntriesCredentialConfiguration.java#L287-L364 |
113,062 | GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/ObjectWriteConditions.java | ObjectWriteConditions.apply | public void apply(Insert objectToInsert) {
if (hasContentGenerationMatch()) {
objectToInsert.setIfGenerationMatch(getContentGenerationMatch());
}
if (hasMetaGenerationMatch()) {
objectToInsert.setIfMetagenerationMatch(getMetaGenerationMatch());
}
} | java | public void apply(Insert objectToInsert) {
if (hasContentGenerationMatch()) {
objectToInsert.setIfGenerationMatch(getContentGenerationMatch());
}
if (hasMetaGenerationMatch()) {
objectToInsert.setIfMetagenerationMatch(getMetaGenerationMatch());
}
} | [
"public",
"void",
"apply",
"(",
"Insert",
"objectToInsert",
")",
"{",
"if",
"(",
"hasContentGenerationMatch",
"(",
")",
")",
"{",
"objectToInsert",
".",
"setIfGenerationMatch",
"(",
"getContentGenerationMatch",
"(",
")",
")",
";",
"}",
"if",
"(",
"hasMetaGenerat... | Apply the conditions represented by this object to an Insert operation. | [
"Apply",
"the",
"conditions",
"represented",
"by",
"this",
"object",
"to",
"an",
"Insert",
"operation",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/ObjectWriteConditions.java#L66-L74 |
113,063 | GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopSyncableOutputStream.java | GoogleHadoopSyncableOutputStream.getNextTemporaryPath | private URI getNextTemporaryPath() {
Path basePath = ghfs.getHadoopPath(finalGcsPath);
Path baseDir = basePath.getParent();
Path tempPath = new Path(
baseDir,
String.format("%s%s.%d.%s",
TEMPFILE_PREFIX, basePath.getName(), curComponentIndex, UUID.randomUUID().toString()));
r... | java | private URI getNextTemporaryPath() {
Path basePath = ghfs.getHadoopPath(finalGcsPath);
Path baseDir = basePath.getParent();
Path tempPath = new Path(
baseDir,
String.format("%s%s.%d.%s",
TEMPFILE_PREFIX, basePath.getName(), curComponentIndex, UUID.randomUUID().toString()));
r... | [
"private",
"URI",
"getNextTemporaryPath",
"(",
")",
"{",
"Path",
"basePath",
"=",
"ghfs",
".",
"getHadoopPath",
"(",
"finalGcsPath",
")",
";",
"Path",
"baseDir",
"=",
"basePath",
".",
"getParent",
"(",
")",
";",
"Path",
"tempPath",
"=",
"new",
"Path",
"(",... | Returns URI to be used for the next "tail" file in the series. | [
"Returns",
"URI",
"to",
"be",
"used",
"for",
"the",
"next",
"tail",
"file",
"in",
"the",
"series",
"."
] | 918d91c80a63e36046edb28972a5c65d3326a858 | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopSyncableOutputStream.java#L313-L321 |
113,064 | zalando/logbook | logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java | DefaultHttpLogFormatter.prepare | @API(status = EXPERIMENTAL)
public List<String> prepare(final Precorrelation precorrelation, final HttpRequest request) throws IOException {
final String requestLine = String.format("%s %s %s", request.getMethod(), request.getRequestUri(),
request.getProtocolVersion());
return prepar... | java | @API(status = EXPERIMENTAL)
public List<String> prepare(final Precorrelation precorrelation, final HttpRequest request) throws IOException {
final String requestLine = String.format("%s %s %s", request.getMethod(), request.getRequestUri(),
request.getProtocolVersion());
return prepar... | [
"@",
"API",
"(",
"status",
"=",
"EXPERIMENTAL",
")",
"public",
"List",
"<",
"String",
">",
"prepare",
"(",
"final",
"Precorrelation",
"precorrelation",
",",
"final",
"HttpRequest",
"request",
")",
"throws",
"IOException",
"{",
"final",
"String",
"requestLine",
... | Produces an HTTP-like request in individual lines.
@param precorrelation the request correlation
@return a line-separated HTTP request
@throws IOException if reading body fails
@see #prepare(Correlation, HttpResponse)
@see #format(List)
@see StructuredHttpLogFormatter#prepare(Precorrelation, HttpRequest) | [
"Produces",
"an",
"HTTP",
"-",
"like",
"request",
"in",
"individual",
"lines",
"."
] | 1c2fe40a2f6a3d2f60e746ab1da173a3907a21c4 | https://github.com/zalando/logbook/blob/1c2fe40a2f6a3d2f60e746ab1da173a3907a21c4/logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java#L35-L40 |
113,065 | zalando/logbook | logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java | DefaultHttpLogFormatter.format | @API(status = EXPERIMENTAL)
public String format(final List<String> lines) {
return String.join("\n", lines);
} | java | @API(status = EXPERIMENTAL)
public String format(final List<String> lines) {
return String.join("\n", lines);
} | [
"@",
"API",
"(",
"status",
"=",
"EXPERIMENTAL",
")",
"public",
"String",
"format",
"(",
"final",
"List",
"<",
"String",
">",
"lines",
")",
"{",
"return",
"String",
".",
"join",
"(",
"\"\\n\"",
",",
"lines",
")",
";",
"}"
] | Renders an HTTP-like message into a printable string.
@param lines lines of an HTTP message
@return the whole message as a single string, separated by new lines
@see #prepare(Precorrelation, HttpRequest)
@see #prepare(Correlation, HttpResponse)
@see StructuredHttpLogFormatter#format(Map) | [
"Renders",
"an",
"HTTP",
"-",
"like",
"message",
"into",
"a",
"printable",
"string",
"."
] | 1c2fe40a2f6a3d2f60e746ab1da173a3907a21c4 | https://github.com/zalando/logbook/blob/1c2fe40a2f6a3d2f60e746ab1da173a3907a21c4/logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java#L121-L124 |
113,066 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.appendArray | public static String appendArray(final String value, final String[] appends) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (appends == null || appends.length == 0) {
return value;
}
StringJoiner joiner = new StringJoiner("");
for (String appen... | java | public static String appendArray(final String value, final String[] appends) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (appends == null || appends.length == 0) {
return value;
}
StringJoiner joiner = new StringJoiner("");
for (String appen... | [
"public",
"static",
"String",
"appendArray",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"[",
"]",
"appends",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"if",
"(",
"appends",
"==",
... | Append an array of String to value
@param value initial String
@param appends an array of strings to append
@return full String | [
"Append",
"an",
"array",
"of",
"String",
"to",
"value"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L71-L81 |
113,067 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.between | public static String[] between(final String value, final String start, final String end) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(start, NULL_STRING_PREDICATE, () -> "'start' should be not null.");
validate(end, NULL_STRING_PREDICATE, () -> "'end' should be no... | java | public static String[] between(final String value, final String start, final String end) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(start, NULL_STRING_PREDICATE, () -> "'start' should be not null.");
validate(end, NULL_STRING_PREDICATE, () -> "'end' should be no... | [
"public",
"static",
"String",
"[",
"]",
"between",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"start",
",",
"final",
"String",
"end",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"... | Returns an array with strings between start and end.
@param value input
@param start start
@param end end
@return Array containing different parts between start and end. | [
"Returns",
"an",
"array",
"with",
"strings",
"between",
"start",
"and",
"end",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L112-L122 |
113,068 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.chars | public static String[] chars(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.split("");
} | java | public static String[] chars(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.split("");
} | [
"public",
"static",
"String",
"[",
"]",
"chars",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"value",
".",
"split",
"(",
"\"\"",
")",
";",
"}"
] | Returns a String array consisting of the characters in the String.
@param value input
@return character array | [
"Returns",
"a",
"String",
"array",
"consisting",
"of",
"the",
"characters",
"in",
"the",
"String",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L130-L133 |
113,069 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.collapseWhitespace | public static String collapseWhitespace(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.trim().replaceAll("\\s\\s+", " ");
} | java | public static String collapseWhitespace(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.trim().replaceAll("\\s\\s+", " ");
} | [
"public",
"static",
"String",
"collapseWhitespace",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"value",
".",
"trim",
"(",
")",
".",
"replaceAll",
"(",
... | Replace consecutive whitespace characters with a single space.
@param value input String
@return collapsed String | [
"Replace",
"consecutive",
"whitespace",
"characters",
"with",
"a",
"single",
"space",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L141-L144 |
113,070 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.contains | public static boolean contains(final String value, final String needle, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.contains(needle);
}
return value.toLowerCase().contains(needle.toLowerCas... | java | public static boolean contains(final String value, final String needle, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.contains(needle);
}
return value.toLowerCase().contains(needle.toLowerCas... | [
"public",
"static",
"boolean",
"contains",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"needle",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"... | Verifies that the needle is contained in the value.
@param value to search
@param needle to find
@param caseSensitive true or false
@return true if found else false. | [
"Verifies",
"that",
"the",
"needle",
"is",
"contained",
"in",
"the",
"value",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L165-L171 |
113,071 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.containsAll | public static boolean containsAll(final String value, final String[] needles) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays.stream(needles).allMatch(needle -> contains(value, needle, false));
} | java | public static boolean containsAll(final String value, final String[] needles) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays.stream(needles).allMatch(needle -> contains(value, needle, false));
} | [
"public",
"static",
"boolean",
"containsAll",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"[",
"]",
"needles",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"Arrays",
".",
"s... | Verifies that all needles are contained in value. The search is case insensitive
@param value input String to search
@param needles needles to find
@return true if all needles are found else false. | [
"Verifies",
"that",
"all",
"needles",
"are",
"contained",
"in",
"value",
".",
"The",
"search",
"is",
"case",
"insensitive"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L180-L183 |
113,072 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.containsAny | public static boolean containsAny(final String value, final String[] needles, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays.stream(needles).anyMatch(needle -> contains(value, needle, caseSensitive));
} | java | public static boolean containsAny(final String value, final String[] needles, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays.stream(needles).anyMatch(needle -> contains(value, needle, caseSensitive));
} | [
"public",
"static",
"boolean",
"containsAny",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"[",
"]",
"needles",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",... | Verifies that one or more of needles are contained in value.
@param value input
@param needles needles to search
@param caseSensitive true or false
@return boolean true if any needle is found else false | [
"Verifies",
"that",
"one",
"or",
"more",
"of",
"needles",
"are",
"contained",
"in",
"value",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L217-L220 |
113,073 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureLeft | public static String ensureLeft(final String value, final String prefix) {
return ensureLeft(value, prefix, true);
} | java | public static String ensureLeft(final String value, final String prefix) {
return ensureLeft(value, prefix, true);
} | [
"public",
"static",
"String",
"ensureLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
")",
"{",
"return",
"ensureLeft",
"(",
"value",
",",
"prefix",
",",
"true",
")",
";",
"}"
] | Ensures that the value begins with prefix. If it doesn't exist, it's prepended. It is case sensitive.
@param value input
@param prefix prefix
@return string with prefix if it was not present. | [
"Ensures",
"that",
"the",
"value",
"begins",
"with",
"prefix",
".",
"If",
"it",
"doesn",
"t",
"exist",
"it",
"s",
"prepended",
".",
"It",
"is",
"case",
"sensitive",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L300-L302 |
113,074 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureLeft | public static String ensureLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(prefix) ? value : prefix + value;
}
String _value = value.toL... | java | public static String ensureLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(prefix) ? value : prefix + value;
}
String _value = value.toL... | [
"public",
"static",
"String",
"ensureLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
... | Ensures that the value begins with prefix. If it doesn't exist, it's prepended.
@param value input
@param prefix prefix
@param caseSensitive true or false
@return string with prefix if it was not present. | [
"Ensures",
"that",
"the",
"value",
"begins",
"with",
"prefix",
".",
"If",
"it",
"doesn",
"t",
"exist",
"it",
"s",
"prepended",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L312-L320 |
113,075 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.base64Decode | public static String base64Decode(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return new String(Base64.getDecoder().decode(value), StandardCharsets.UTF_8);
} | java | public static String base64Decode(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return new String(Base64.getDecoder().decode(value), StandardCharsets.UTF_8);
} | [
"public",
"static",
"String",
"base64Decode",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"new",
"String",
"(",
"Base64",
".",
"getDecoder",
"(",
")",
"... | Decodes data encoded with MIME base64
@param value The data to decode
@return decoded data | [
"Decodes",
"data",
"encoded",
"with",
"MIME",
"base64"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L328-L331 |
113,076 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.base64Encode | public static String base64Encode(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Base64.getEncoder().encodeToString(value.getBytes(StandardCharsets.UTF_8));
} | java | public static String base64Encode(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Base64.getEncoder().encodeToString(value.getBytes(StandardCharsets.UTF_8));
} | [
"public",
"static",
"String",
"base64Encode",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"Base64",
".",
"getEncoder",
"(",
")",
".",
"encodeToString",
"(... | Encodes data with MIME base64.
@param value The data to encode
@return The encoded String | [
"Encodes",
"data",
"with",
"MIME",
"base64",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L339-L342 |
113,077 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureRight | public static String ensureRight(final String value, final String suffix) {
return ensureRight(value, suffix, true);
} | java | public static String ensureRight(final String value, final String suffix) {
return ensureRight(value, suffix, true);
} | [
"public",
"static",
"String",
"ensureRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"ensureRight",
"(",
"value",
",",
"suffix",
",",
"true",
")",
";",
"}"
] | Ensures that the value ends with suffix. If it doesn't, it's appended. This operation is case sensitive.
@param value The input String
@param suffix The substr to be ensured to be right
@return The string which is guarenteed to start with substr | [
"Ensures",
"that",
"the",
"value",
"ends",
"with",
"suffix",
".",
"If",
"it",
"doesn",
"t",
"it",
"s",
"appended",
".",
"This",
"operation",
"is",
"case",
"sensitive",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L391-L393 |
113,078 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureRight | public static String ensureRight(final String value, final String suffix, boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value : append(value, suffix);
} | java | public static String ensureRight(final String value, final String suffix, boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value : append(value, suffix);
} | [
"public",
"static",
"String",
"ensureRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
",",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
... | Ensures that the value ends with suffix. If it doesn't, it's appended.
@param value The input String
@param suffix The substr to be ensured to be right
@param caseSensitive Use case (in-)sensitive matching for determining if value already ends with suffix
@return The string which is guarenteed to start ... | [
"Ensures",
"that",
"the",
"value",
"ends",
"with",
"suffix",
".",
"If",
"it",
"doesn",
"t",
"it",
"s",
"appended",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L403-L406 |
113,079 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.first | public static Optional<String> first(final String value, final int n) {
return Optional.ofNullable(value).filter(v -> !v.isEmpty()).map(v -> v.substring(0, n));
} | java | public static Optional<String> first(final String value, final int n) {
return Optional.ofNullable(value).filter(v -> !v.isEmpty()).map(v -> v.substring(0, n));
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"first",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"n",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"value",
")",
".",
"filter",
"(",
"v",
"->",
"!",
"v",
".",
"isEmpty",
"("... | Returns the first n chars of String
@param value The input String
@param n Number of chars to return
@return The first n chars | [
"Returns",
"the",
"first",
"n",
"chars",
"of",
"String"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L415-L417 |
113,080 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.format | public static String format(final String value, String... params) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
Pattern p = Pattern.compile("\\{(\\w+)}");
Matcher m = p.matcher(value);
String result = value;
while (m.find()) {
int paramNumber = I... | java | public static String format(final String value, String... params) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
Pattern p = Pattern.compile("\\{(\\w+)}");
Matcher m = p.matcher(value);
String result = value;
while (m.find()) {
int paramNumber = I... | [
"public",
"static",
"String",
"format",
"(",
"final",
"String",
"value",
",",
"String",
"...",
"params",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile"... | Formats a string using parameters
@param value The value to be formatted
@param params Parameters to be described in the string
@return The formatted string | [
"Formats",
"a",
"string",
"using",
"parameters"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L436-L449 |
113,081 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.insert | public static String insert(final String value, final String substr, final int index) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(substr, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (index > value.length()) {
return value;
}
r... | java | public static String insert(final String value, final String substr, final int index) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(substr, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (index > value.length()) {
return value;
}
r... | [
"public",
"static",
"String",
"insert",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"substr",
",",
"final",
"int",
"index",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"validate",
"(... | Inserts 'substr' into the 'value' at the 'index' provided.
@param value The input String
@param substr The String to insert
@param index The index to insert substr
@return String with substr added | [
"Inserts",
"substr",
"into",
"the",
"value",
"at",
"the",
"index",
"provided",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L520-L527 |
113,082 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.isUpperCase | public static boolean isUpperCase(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
for (int i = 0; i < value.length(); i++) {
if (Character.isLowerCase(value.charAt(i))) {
return false;
}
}
return true;
} | java | public static boolean isUpperCase(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
for (int i = 0; i < value.length(); i++) {
if (Character.isLowerCase(value.charAt(i))) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isUpperCase",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"leng... | Verifies if String is uppercase
@param value The input String
@return true if String is uppercase false otherwise | [
"Verifies",
"if",
"String",
"is",
"uppercase"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L535-L543 |
113,083 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.last | public static String last(final String value, int n) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (n > value.length()) {
return value;
}
return value.substring(value.length() - n);
} | java | public static String last(final String value, int n) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (n > value.length()) {
return value;
}
return value.substring(value.length() - n);
} | [
"public",
"static",
"String",
"last",
"(",
"final",
"String",
"value",
",",
"int",
"n",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"if",
"(",
"n",
">",
"value",
".",
"length",
"(",
")",
")... | Return the last n chars of String
@param value The input String
@param n Number of chars to return
@return n Last characters | [
"Return",
"the",
"last",
"n",
"chars",
"of",
"String"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L568-L574 |
113,084 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.leftPad | public static String leftPad(final String value, final String pad, final int length) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(pad, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (value.length() > length) {
return value;
}
retu... | java | public static String leftPad(final String value, final String pad, final int length) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(pad, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (value.length() > length) {
return value;
}
retu... | [
"public",
"static",
"String",
"leftPad",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"pad",
",",
"final",
"int",
"length",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"validate",
"("... | Returns a new string of a given length such that the beginning of the string is padded.
@param value The input String
@param pad The pad
@param length Length of the String we want
@return Padded String | [
"Returns",
"a",
"new",
"string",
"of",
"a",
"given",
"length",
"such",
"that",
"the",
"beginning",
"of",
"the",
"string",
"is",
"padded",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L584-L591 |
113,085 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.lastIndexOf | public static int lastIndexOf(final String value, final String needle) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return lastIndexOf(value, needle, value.length(), true);
} | java | public static int lastIndexOf(final String value, final String needle) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return lastIndexOf(value, needle, value.length(), true);
} | [
"public",
"static",
"int",
"lastIndexOf",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"needle",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"lastIndexOf",
"(",
"value",
",",
... | This method returns the index within the calling String object of the last occurrence of the specified value, searching backwards from the offset.
Returns -1 if the value is not found. The search starts from the end and case sensitive.
@param value The input String
@param needle The search String
@return Return posit... | [
"This",
"method",
"returns",
"the",
"index",
"within",
"the",
"calling",
"String",
"object",
"of",
"the",
"last",
"occurrence",
"of",
"the",
"specified",
"value",
"searching",
"backwards",
"from",
"the",
"offset",
".",
"Returns",
"-",
"1",
"if",
"the",
"valu... | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L614-L617 |
113,086 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.lastIndexOf | public static int lastIndexOf(final String value, final String needle, final int offset,
final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(needle, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseS... | java | public static int lastIndexOf(final String value, final String needle, final int offset,
final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(needle, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseS... | [
"public",
"static",
"int",
"lastIndexOf",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"needle",
",",
"final",
"int",
"offset",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_S... | This method returns the index within the calling String object of the last occurrence of the specified value, searching backwards from the offset.
Returns -1 if the value is not found.
@param value The input String
@param needle The search String
@param offset The index to start search from
@para... | [
"This",
"method",
"returns",
"the",
"index",
"within",
"the",
"calling",
"String",
"object",
"of",
"the",
"last",
"occurrence",
"of",
"the",
"specified",
"value",
"searching",
"backwards",
"from",
"the",
"offset",
".",
"Returns",
"-",
"1",
"if",
"the",
"valu... | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L643-L651 |
113,087 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.leftTrim | public static String leftTrim(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("^\\s+", "");
} | java | public static String leftTrim(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("^\\s+", "");
} | [
"public",
"static",
"String",
"leftTrim",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"value",
".",
"replaceAll",
"(",
"\"^\\\\s+\"",
",",
"\"\"",
")",
... | Removes all spaces on left
@param value The input String
@return String without left border spaces | [
"Removes",
"all",
"spaces",
"on",
"left"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L659-L662 |
113,088 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.prependArray | public static String prependArray(final String value, final String[] prepends) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (prepends == null || prepends.length == 0) {
return value;
}
StringJoiner joiner = new StringJoiner("");
for (String p... | java | public static String prependArray(final String value, final String[] prepends) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (prepends == null || prepends.length == 0) {
return value;
}
StringJoiner joiner = new StringJoiner("");
for (String p... | [
"public",
"static",
"String",
"prependArray",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"[",
"]",
"prepends",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"if",
"(",
"prepends",
"==... | Return a new String starting with prepends
@param value The input String
@param prepends Strings to prepend
@return The prepended String | [
"Return",
"a",
"new",
"String",
"starting",
"with",
"prepends"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L693-L703 |
113,089 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeEmptyStrings | public static String[] removeEmptyStrings(String[] strings) {
if (Objects.isNull(strings)) {
throw new IllegalArgumentException("Input array should not be null");
}
return Arrays.stream(strings).filter(str -> str != null && !str.trim().isEmpty()).toArray(String[]::new);
} | java | public static String[] removeEmptyStrings(String[] strings) {
if (Objects.isNull(strings)) {
throw new IllegalArgumentException("Input array should not be null");
}
return Arrays.stream(strings).filter(str -> str != null && !str.trim().isEmpty()).toArray(String[]::new);
} | [
"public",
"static",
"String",
"[",
"]",
"removeEmptyStrings",
"(",
"String",
"[",
"]",
"strings",
")",
"{",
"if",
"(",
"Objects",
".",
"isNull",
"(",
"strings",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input array should not be null\"",... | Remove empty Strings from string array
@param strings Array of String to be cleaned
@return Array of String without empty Strings | [
"Remove",
"empty",
"Strings",
"from",
"string",
"array"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L711-L716 |
113,090 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeLeft | public static String removeLeft(final String value, final String prefix) {
return removeLeft(value, prefix, true);
} | java | public static String removeLeft(final String value, final String prefix) {
return removeLeft(value, prefix, true);
} | [
"public",
"static",
"String",
"removeLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
")",
"{",
"return",
"removeLeft",
"(",
"value",
",",
"prefix",
",",
"true",
")",
";",
"}"
] | Returns a new String with the prefix removed, if present. This is case sensitive.
@param value The input String
@param prefix String to remove on left
@return The String without prefix | [
"Returns",
"a",
"new",
"String",
"with",
"the",
"prefix",
"removed",
"if",
"present",
".",
"This",
"is",
"case",
"sensitive",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L725-L727 |
113,091 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeLeft | public static String removeLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(prefix, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(pr... | java | public static String removeLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(prefix, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(pr... | [
"public",
"static",
"String",
"removeLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
... | Returns a new String with the prefix removed, if present.
@param value The input String
@param prefix String to remove on left
@param caseSensitive ensure case sensitivity
@return The String without prefix | [
"Returns",
"a",
"new",
"String",
"with",
"the",
"prefix",
"removed",
"if",
"present",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L737-L744 |
113,092 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeNonWords | public static String removeNonWords(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("[^\\w]+", "");
} | java | public static String removeNonWords(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("[^\\w]+", "");
} | [
"public",
"static",
"String",
"removeNonWords",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"value",
".",
"replaceAll",
"(",
"\"[^\\\\w]+\"",
",",
"\"\"",
... | Remove all non word characters.
@param value The input String
@return String without non-word characters | [
"Remove",
"all",
"non",
"word",
"characters",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L752-L755 |
113,093 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeRight | public static String removeRight(final String value, final String suffix) {
return removeRight(value, suffix, true);
} | java | public static String removeRight(final String value, final String suffix) {
return removeRight(value, suffix, true);
} | [
"public",
"static",
"String",
"removeRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"removeRight",
"(",
"value",
",",
"suffix",
",",
"true",
")",
";",
"}"
] | Returns a new string with the 'suffix' removed, if present. Search is case sensitive.
@param value The input String
@param suffix The suffix to remove
@return The String without suffix! | [
"Returns",
"a",
"new",
"string",
"with",
"the",
"suffix",
"removed",
"if",
"present",
".",
"Search",
"is",
"case",
"sensitive",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L764-L766 |
113,094 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeRight | public static String removeRight(final String value, final String suffix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(suffix, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value
... | java | public static String removeRight(final String value, final String suffix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(suffix, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value
... | [
"public",
"static",
"String",
"removeRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
... | Returns a new string with the 'suffix' removed, if present.
@param value The input String
@param suffix The suffix to remove
@param caseSensitive whether search should be case sensitive or not
@return The String without suffix! | [
"Returns",
"a",
"new",
"string",
"with",
"the",
"suffix",
"removed",
"if",
"present",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L776-L781 |
113,095 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeSpaces | public static String removeSpaces(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("\\s", "");
} | java | public static String removeSpaces(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("\\s", "");
} | [
"public",
"static",
"String",
"removeSpaces",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"value",
".",
"replaceAll",
"(",
"\"\\\\s\"",
",",
"\"\"",
")",
... | Remove all spaces and replace for value.
@param value The input String
@return String without spaces | [
"Remove",
"all",
"spaces",
"and",
"replace",
"for",
"value",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L789-L792 |
113,096 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.repeat | public static String repeat(final String value, final int multiplier) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Stream.generate(() -> value).limit(multiplier).collect(joining());
} | java | public static String repeat(final String value, final int multiplier) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Stream.generate(() -> value).limit(multiplier).collect(joining());
} | [
"public",
"static",
"String",
"repeat",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"multiplier",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"Stream",
".",
"generate",
"(",
"... | Returns a repeated string given a multiplier.
@param value The input String
@param multiplier Number of repeats
@return The String repeated | [
"Returns",
"a",
"repeated",
"string",
"given",
"a",
"multiplier",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L801-L804 |
113,097 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.replace | public static String replace(final String value, final String search, final String newValue,
final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(search, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (ca... | java | public static String replace(final String value, final String search, final String newValue,
final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(search, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (ca... | [
"public",
"static",
"String",
"replace",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"search",
",",
"final",
"String",
"newValue",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NU... | Replace all occurrences of 'search' value to 'newvalue'. Uses String replace method.
@param value The input
@param search The String to search
@param newValue The String to replace
@param caseSensitive whether search should be case sensitive or not
@return String replaced with 'newvalue'. | [
"Replace",
"all",
"occurrences",
"of",
"search",
"value",
"to",
"newvalue",
".",
"Uses",
"String",
"replace",
"method",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L815-L824 |
113,098 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.reverse | public static String reverse(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return new StringBuilder(value).reverse().toString();
} | java | public static String reverse(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return new StringBuilder(value).reverse().toString();
} | [
"public",
"static",
"String",
"reverse",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"new",
"StringBuilder",
"(",
"value",
")",
".",
"reverse",
"(",
")"... | Reverse the input String
@param value The input String
@return Reversed String | [
"Reverse",
"the",
"input",
"String"
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L832-L835 |
113,099 | shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.rightTrim | public static String rightTrim(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("\\s+$", "");
} | java | public static String rightTrim(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.replaceAll("\\s+$", "");
} | [
"public",
"static",
"String",
"rightTrim",
"(",
"final",
"String",
"value",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"value",
".",
"replaceAll",
"(",
"\"\\\\s+$\"",
",",
"\"\"",
")",
... | Remove all spaces on right.
@param value The String
@return String without right boarders spaces. | [
"Remove",
"all",
"spaces",
"on",
"right",
"."
] | d0c2a10a6273fd6082f084e95156653ca55ce1be | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L859-L862 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.