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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/stax/StAXUtils.java | StAXUtils.skipElement | public static int skipElement(XMLStreamReader xmlReader) throws XMLStreamException
{
if (!xmlReader.isStartElement()) {
throw new XMLStreamException("Current node is not start element");
}
if (!xmlReader.isEndElement()) {
for (xmlReader.next(); !xmlReader.isEndElemen... | java | public static int skipElement(XMLStreamReader xmlReader) throws XMLStreamException
{
if (!xmlReader.isStartElement()) {
throw new XMLStreamException("Current node is not start element");
}
if (!xmlReader.isEndElement()) {
for (xmlReader.next(); !xmlReader.isEndElemen... | [
"public",
"static",
"int",
"skipElement",
"(",
"XMLStreamReader",
"xmlReader",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"!",
"xmlReader",
".",
"isStartElement",
"(",
")",
")",
"{",
"throw",
"new",
"XMLStreamException",
"(",
"\"Current node is not start e... | Go to the end of the current element. This include skipping any children element.
@param xmlReader the XML stream reader
@return the type of the new current event
@throws XMLStreamException if there is an error processing the underlying XML source
@since 5.3M1 | [
"Go",
"to",
"the",
"end",
"of",
"the",
"current",
"element",
".",
"This",
"include",
"skipping",
"any",
"children",
"element",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/stax/StAXUtils.java#L190-L205 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java | DefaultInstalledExtension.isDependency | public static boolean isDependency(Extension extension, String namespace)
{
boolean isDependency = false;
if (namespace == null) {
isDependency = extension.getProperty(PKEY_DEPENDENCY, false);
} else {
Object namespacesObject = extension.getProperty(PKEY_NAMESPACES);... | java | public static boolean isDependency(Extension extension, String namespace)
{
boolean isDependency = false;
if (namespace == null) {
isDependency = extension.getProperty(PKEY_DEPENDENCY, false);
} else {
Object namespacesObject = extension.getProperty(PKEY_NAMESPACES);... | [
"public",
"static",
"boolean",
"isDependency",
"(",
"Extension",
"extension",
",",
"String",
"namespace",
")",
"{",
"boolean",
"isDependency",
"=",
"false",
";",
"if",
"(",
"namespace",
"==",
"null",
")",
"{",
"isDependency",
"=",
"extension",
".",
"getPropert... | Indicate if the extension as been installed as a dependency of another one.
@param extension the extension
@param namespace the namespace to look at, null indicate the root namespace
@return true if the the extension has been installed only because it was a dependency of another extension
@see InstalledExtension#isDep... | [
"Indicate",
"if",
"the",
"extension",
"as",
"been",
"installed",
"as",
"a",
"dependency",
"of",
"another",
"one",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java#L112-L135 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java | DefaultInstalledExtension.setNamespaceProperty | public void setNamespaceProperty(String key, Object value, String namespace)
{
try {
this.propertiesLock.lock();
Map<String, Object> namespaceProperties = getNamespaceProperties(namespace);
if (namespaceProperties != null) {
namespaceProperties.put(key, v... | java | public void setNamespaceProperty(String key, Object value, String namespace)
{
try {
this.propertiesLock.lock();
Map<String, Object> namespaceProperties = getNamespaceProperties(namespace);
if (namespaceProperties != null) {
namespaceProperties.put(key, v... | [
"public",
"void",
"setNamespaceProperty",
"(",
"String",
"key",
",",
"Object",
"value",
",",
"String",
"namespace",
")",
"{",
"try",
"{",
"this",
".",
"propertiesLock",
".",
"lock",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"namespacePropert... | Sets the value of the specified extension property on the given namespace.
@param key the extension property to set
@param value the property value
@param namespace the namespace to associate the property with, {@code null} for the root namespace
@since 7.0M2 | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"extension",
"property",
"on",
"the",
"given",
"namespace",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java#L504-L516 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/script/ProgressScripService.java | ProgressScripService.startStep | public void startStep(String translationKey, String message, Object... arguments)
{
this.progress.startStep(this, new Message(translationKey, message, arguments));
} | java | public void startStep(String translationKey, String message, Object... arguments)
{
this.progress.startStep(this, new Message(translationKey, message, arguments));
} | [
"public",
"void",
"startStep",
"(",
"String",
"translationKey",
",",
"String",
"message",
",",
"Object",
"...",
"arguments",
")",
"{",
"this",
".",
"progress",
".",
"startStep",
"(",
"this",
",",
"new",
"Message",
"(",
"translationKey",
",",
"message",
",",
... | Close current step if any and move to next one.
@param translationKey the key used to find the translation of the step message
@param message the default message associated to the step
@param arguments the arguments to insert in the step message | [
"Close",
"current",
"step",
"if",
"any",
"and",
"move",
"to",
"next",
"one",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/script/ProgressScripService.java#L96-L99 | train |
xwiki/xwiki-commons | xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/UnXARMojo.java | UnXARMojo.performUnArchive | private void performUnArchive() throws MojoExecutionException
{
Artifact artifact = findArtifact();
getLog().debug(String.format("Source XAR = [%s]", artifact.getFile()));
unpack(artifact.getFile(), this.outputDirectory, "XAR Plugin", true, getIncludes(), getExcludes());
unpackDepen... | java | private void performUnArchive() throws MojoExecutionException
{
Artifact artifact = findArtifact();
getLog().debug(String.format("Source XAR = [%s]", artifact.getFile()));
unpack(artifact.getFile(), this.outputDirectory, "XAR Plugin", true, getIncludes(), getExcludes());
unpackDepen... | [
"private",
"void",
"performUnArchive",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"Artifact",
"artifact",
"=",
"findArtifact",
"(",
")",
";",
"getLog",
"(",
")",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Source XAR = [%s]\"",
",",
"artifact",
... | Unzip xar artifact and its dependencies.
@throws ArchiverException error when unzip package.O
@throws MojoExecutionException error when unzip package. | [
"Unzip",
"xar",
"artifact",
"and",
"its",
"dependencies",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/UnXARMojo.java#L111-L118 | train |
xwiki/xwiki-commons | xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/UnXARMojo.java | UnXARMojo.unpackDependentXars | protected void unpackDependentXars(Artifact artifact) throws MojoExecutionException
{
try {
Set<Artifact> dependencies = resolveArtifactDependencies(artifact);
for (Artifact dependency : dependencies) {
unpack(dependency.getFile(), this.outputDirectory, "XAR Plugin", ... | java | protected void unpackDependentXars(Artifact artifact) throws MojoExecutionException
{
try {
Set<Artifact> dependencies = resolveArtifactDependencies(artifact);
for (Artifact dependency : dependencies) {
unpack(dependency.getFile(), this.outputDirectory, "XAR Plugin", ... | [
"protected",
"void",
"unpackDependentXars",
"(",
"Artifact",
"artifact",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"Set",
"<",
"Artifact",
">",
"dependencies",
"=",
"resolveArtifactDependencies",
"(",
"artifact",
")",
";",
"for",
"(",
"Artifact",
"... | Unpack xar dependencies of the provided artifact.
@throws MojoExecutionException error when unpack dependencies. | [
"Unpack",
"xar",
"dependencies",
"of",
"the",
"provided",
"artifact",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/UnXARMojo.java#L125-L135 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java | InfinispanConfigurationLoader.customizeEviction | private void customizeEviction(ConfigurationBuilder builder)
{
EntryEvictionConfiguration eec =
(EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID);
if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) {
... | java | private void customizeEviction(ConfigurationBuilder builder)
{
EntryEvictionConfiguration eec =
(EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID);
if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) {
... | [
"private",
"void",
"customizeEviction",
"(",
"ConfigurationBuilder",
"builder",
")",
"{",
"EntryEvictionConfiguration",
"eec",
"=",
"(",
"EntryEvictionConfiguration",
")",
"getCacheConfiguration",
"(",
")",
".",
"get",
"(",
"EntryEvictionConfiguration",
".",
"CONFIGURATIO... | Customize the eviction configuration.
@param buil the configuration builder
@param configuration the configuration
@return the configuration builder | [
"Customize",
"the",
"eviction",
"configuration",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java#L74-L96 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java | InfinispanConfigurationLoader.completeFilesystem | private void completeFilesystem(ConfigurationBuilder builder, Configuration configuration)
{
PersistenceConfigurationBuilder persistence = builder.persistence();
if (containsIncompleteFileLoader(configuration)) {
for (StoreConfigurationBuilder<?, ?> store : persistence.stores()) {
... | java | private void completeFilesystem(ConfigurationBuilder builder, Configuration configuration)
{
PersistenceConfigurationBuilder persistence = builder.persistence();
if (containsIncompleteFileLoader(configuration)) {
for (StoreConfigurationBuilder<?, ?> store : persistence.stores()) {
... | [
"private",
"void",
"completeFilesystem",
"(",
"ConfigurationBuilder",
"builder",
",",
"Configuration",
"configuration",
")",
"{",
"PersistenceConfigurationBuilder",
"persistence",
"=",
"builder",
".",
"persistence",
"(",
")",
";",
"if",
"(",
"containsIncompleteFileLoader"... | Add missing location for filesystem based cache.
@param currentBuilder the configuration builder
@param configuration the configuration
@return the configuration builder | [
"Add",
"missing",
"location",
"for",
"filesystem",
"based",
"cache",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java#L162-L175 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java | InfinispanConfigurationLoader.customize | public Configuration customize(Configuration defaultConfiguration, Configuration namedConfiguration)
{
// Set custom configuration
ConfigurationBuilder builder = new ConfigurationBuilder();
// Named configuration have priority
if (namedConfiguration != null) {
read(buil... | java | public Configuration customize(Configuration defaultConfiguration, Configuration namedConfiguration)
{
// Set custom configuration
ConfigurationBuilder builder = new ConfigurationBuilder();
// Named configuration have priority
if (namedConfiguration != null) {
read(buil... | [
"public",
"Configuration",
"customize",
"(",
"Configuration",
"defaultConfiguration",
",",
"Configuration",
"namedConfiguration",
")",
"{",
"// Set custom configuration",
"ConfigurationBuilder",
"builder",
"=",
"new",
"ConfigurationBuilder",
"(",
")",
";",
"// Named configura... | Customize provided configuration based on XWiki cache configuration.
@param defaultConfiguration the default Infinispan configuration
@param namedConfiguration the named default Infinispan configuration
@return the new configuration or the passed one if nothing changed | [
"Customize",
"provided",
"configuration",
"based",
"on",
"XWiki",
"cache",
"configuration",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java#L184-L203 | train |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-logging/xwiki-commons-logging-api/src/main/java/org/xwiki/logging/LogQueue.java | LogQueue.containLogsFrom | public boolean containLogsFrom(LogLevel level)
{
for (LogEvent log : this) {
if (log.getLevel().compareTo(level) <= 0) {
return true;
}
}
return false;
} | java | public boolean containLogsFrom(LogLevel level)
{
for (LogEvent log : this) {
if (log.getLevel().compareTo(level) <= 0) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"containLogsFrom",
"(",
"LogLevel",
"level",
")",
"{",
"for",
"(",
"LogEvent",
"log",
":",
"this",
")",
"{",
"if",
"(",
"log",
".",
"getLevel",
"(",
")",
".",
"compareTo",
"(",
"level",
")",
"<=",
"0",
")",
"{",
"return",
"true",... | Indicate if the list contains logs of a specific level.
@param level the level of the logs to return
@return true if log of provided level or less exist
@since 6.0M1 | [
"Indicate",
"if",
"the",
"list",
"contains",
"logs",
"of",
"a",
"specific",
"level",
"."
] | 5374d8c6d966588c1eac7392c83da610dfb9f129 | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-logging/xwiki-commons-logging-api/src/main/java/org/xwiki/logging/LogQueue.java#L175-L184 | train |
shrinkwrap/shrinkwrap | api/src/main/java/org/jboss/shrinkwrap/api/asset/ClassAsset.java | ClassAsset.openStream | @Override
public InputStream openStream() {
/*
* https://jira.jboss.org/jira/browse/TMPARCH-19 If class is loaded by the Bootstrap ClassLoader, getClassLoader
* will return null. Use Thread Current Context ClassLoader instead.
*/
ClassLoader classLoader = clazz.getClassLoa... | java | @Override
public InputStream openStream() {
/*
* https://jira.jboss.org/jira/browse/TMPARCH-19 If class is loaded by the Bootstrap ClassLoader, getClassLoader
* will return null. Use Thread Current Context ClassLoader instead.
*/
ClassLoader classLoader = clazz.getClassLoa... | [
"@",
"Override",
"public",
"InputStream",
"openStream",
"(",
")",
"{",
"/*\n * https://jira.jboss.org/jira/browse/TMPARCH-19 If class is loaded by the Bootstrap ClassLoader, getClassLoader\n * will return null. Use Thread Current Context ClassLoader instead.\n */",
"ClassLo... | Converts the Class name into a Resource URL and uses the ClassloaderResource for loading the Class. | [
"Converts",
"the",
"Class",
"name",
"into",
"a",
"Resource",
"URL",
"and",
"uses",
"the",
"ClassloaderResource",
"for",
"loading",
"the",
"Class",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/api/src/main/java/org/jboss/shrinkwrap/api/asset/ClassAsset.java#L67-L78 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/importer/ExplodedImporterImpl.java | ExplodedImporterImpl.calculatePath | private ArchivePath calculatePath(File root, File child) {
String rootPath = unifyPath(root.getPath());
String childPath = unifyPath(child.getPath());
String archiveChildPath = childPath.replaceFirst(Pattern.quote(rootPath), "");
return new BasicPath(archiveChildPath);
} | java | private ArchivePath calculatePath(File root, File child) {
String rootPath = unifyPath(root.getPath());
String childPath = unifyPath(child.getPath());
String archiveChildPath = childPath.replaceFirst(Pattern.quote(rootPath), "");
return new BasicPath(archiveChildPath);
} | [
"private",
"ArchivePath",
"calculatePath",
"(",
"File",
"root",
",",
"File",
"child",
")",
"{",
"String",
"rootPath",
"=",
"unifyPath",
"(",
"root",
".",
"getPath",
"(",
")",
")",
";",
"String",
"childPath",
"=",
"unifyPath",
"(",
"child",
".",
"getPath",
... | Calculate the relative child path.
@param root
The Archive root folder
@param child
The Child file
@return a Path fort he child relative to root | [
"Calculate",
"the",
"relative",
"child",
"path",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/importer/ExplodedImporterImpl.java#L142-L147 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.initialize | private void initialize(int blockSize, int recordSize) {
this.debug = false;
this.blockSize = blockSize;
this.recordSize = recordSize;
this.recsPerBlock = (this.blockSize / this.recordSize);
this.blockBuffer = new byte[this.blockSize];
if (this.inStream != null) {
... | java | private void initialize(int blockSize, int recordSize) {
this.debug = false;
this.blockSize = blockSize;
this.recordSize = recordSize;
this.recsPerBlock = (this.blockSize / this.recordSize);
this.blockBuffer = new byte[this.blockSize];
if (this.inStream != null) {
... | [
"private",
"void",
"initialize",
"(",
"int",
"blockSize",
",",
"int",
"recordSize",
")",
"{",
"this",
".",
"debug",
"=",
"false",
";",
"this",
".",
"blockSize",
"=",
"blockSize",
";",
"this",
".",
"recordSize",
"=",
"recordSize",
";",
"this",
".",
"recsP... | Initialization common to all constructors. | [
"Initialization",
"common",
"to",
"all",
"constructors",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L81-L95 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.isEOFRecord | public boolean isEOFRecord(byte[] record) {
for (int i = 0, sz = this.getRecordSize(); i < sz; ++i) {
if (record[i] != 0) {
return false;
}
}
return true;
} | java | public boolean isEOFRecord(byte[] record) {
for (int i = 0, sz = this.getRecordSize(); i < sz; ++i) {
if (record[i] != 0) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"isEOFRecord",
"(",
"byte",
"[",
"]",
"record",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"sz",
"=",
"this",
".",
"getRecordSize",
"(",
")",
";",
"i",
"<",
"sz",
";",
"++",
"i",
")",
"{",
"if",
"(",
"record",
"[",
... | Determine if an archive record indicate End of Archive. End of archive is indicated by a record that consists
entirely of null bytes.
@param record
The record data to check. | [
"Determine",
"if",
"an",
"archive",
"record",
"indicate",
"End",
"of",
"Archive",
".",
"End",
"of",
"archive",
"is",
"indicated",
"by",
"a",
"record",
"that",
"consists",
"entirely",
"of",
"null",
"bytes",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L128-L136 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.skipRecord | public void skipRecord() throws IOException {
if (this.debug) {
System.err.println("SkipRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.inStream == null) {
throw new IOException("reading (via skip) from an output buffer");
}
... | java | public void skipRecord() throws IOException {
if (this.debug) {
System.err.println("SkipRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.inStream == null) {
throw new IOException("reading (via skip) from an output buffer");
}
... | [
"public",
"void",
"skipRecord",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"SkipRecord: recIdx = \"",
"+",
"this",
".",
"currRecIdx",
"+",
"\" blkIdx = \"",
"+",
"this",
"... | Skip over a record on the input stream. | [
"Skip",
"over",
"a",
"record",
"on",
"the",
"input",
"stream",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L142-L158 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.readRecord | public byte[] readRecord() throws IOException {
if (this.debug) {
System.err.println("ReadRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.inStream == null) {
throw new IOException("reading from an output buffer");
}
if ... | java | public byte[] readRecord() throws IOException {
if (this.debug) {
System.err.println("ReadRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.inStream == null) {
throw new IOException("reading from an output buffer");
}
if ... | [
"public",
"byte",
"[",
"]",
"readRecord",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"ReadRecord: recIdx = \"",
"+",
"this",
".",
"currRecIdx",
"+",
"\" blkIdx = \"",
"+",... | Read a record from the input stream and return the data.
@return The record data. | [
"Read",
"a",
"record",
"from",
"the",
"input",
"stream",
"and",
"return",
"the",
"data",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L166-L188 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.writeRecord | public void writeRecord(byte[] record) throws IOException {
if (this.debug) {
System.err.println("WriteRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
}
... | java | public void writeRecord(byte[] record) throws IOException {
if (this.debug) {
System.err.println("WriteRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
}
... | [
"public",
"void",
"writeRecord",
"(",
"byte",
"[",
"]",
"record",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"WriteRecord: recIdx = \"",
"+",
"this",
".",
"currRecIdx",
"+",
... | Write an archive record to the archive.
@param record
The record data to write to the archive. | [
"Write",
"an",
"archive",
"record",
"to",
"the",
"archive",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L269-L290 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.writeRecord | public void writeRecord(byte[] buf, int offset) throws IOException {
if (this.debug) {
System.err.println("WriteRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
... | java | public void writeRecord(byte[] buf, int offset) throws IOException {
if (this.debug) {
System.err.println("WriteRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
... | [
"public",
"void",
"writeRecord",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"WriteRecord: recIdx = \"",
"+",
"this",
".",
... | Write an archive record to the archive, where the record may be inside of a larger array buffer. The buffer must
be "offset plus record size" long.
@param buf
The buffer containing the record data to write.
@param offset
The offset of the record data within buf. | [
"Write",
"an",
"archive",
"record",
"to",
"the",
"archive",
"where",
"the",
"record",
"may",
"be",
"inside",
"of",
"a",
"larger",
"array",
"buffer",
".",
"The",
"buffer",
"must",
"be",
"offset",
"plus",
"record",
"size",
"long",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L302-L323 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.writeBlock | private void writeBlock() throws IOException {
if (this.debug) {
System.err.println("WriteBlock: blkIdx = " + this.currBlkIdx);
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
}
this.outStream.write(this.blockBuffer, ... | java | private void writeBlock() throws IOException {
if (this.debug) {
System.err.println("WriteBlock: blkIdx = " + this.currBlkIdx);
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
}
this.outStream.write(this.blockBuffer, ... | [
"private",
"void",
"writeBlock",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"WriteBlock: blkIdx = \"",
"+",
"this",
".",
"currBlkIdx",
")",
";",
"}",
"if",
"(",
"this",
... | Write a TarBuffer block to the archive. | [
"Write",
"a",
"TarBuffer",
"block",
"to",
"the",
"archive",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L328-L342 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.flushBlock | private void flushBlock() throws IOException {
if (this.debug) {
System.err.println("TarBuffer.flushBlock() called.");
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
}
// Thanks to 'Todd Kofford <tkofford@bigfoot.com... | java | private void flushBlock() throws IOException {
if (this.debug) {
System.err.println("TarBuffer.flushBlock() called.");
}
if (this.outStream == null) {
throw new IOException("writing to an input buffer");
}
// Thanks to 'Todd Kofford <tkofford@bigfoot.com... | [
"private",
"void",
"flushBlock",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"TarBuffer.flushBlock() called.\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"outStream",
"==",
... | Flush the current data block if it has any data in it. | [
"Flush",
"the",
"current",
"data",
"block",
"if",
"it",
"has",
"any",
"data",
"in",
"it",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L348-L371 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java | TarBuffer.close | public void close() throws IOException {
if (this.debug) {
System.err.println("TarBuffer.closeBuffer().");
}
if (this.outStream != null) {
this.flushBlock();
if (this.outStream != System.out && this.outStream != System.err) {
this.outStream.c... | java | public void close() throws IOException {
if (this.debug) {
System.err.println("TarBuffer.closeBuffer().");
}
if (this.outStream != null) {
this.flushBlock();
if (this.outStream != System.out && this.outStream != System.err) {
this.outStream.c... | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"debug",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"TarBuffer.closeBuffer().\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"outStream",
"!=",
"null",
"... | Close the TarBuffer. If this is an output buffer, also flush the current block before closing. | [
"Close",
"the",
"TarBuffer",
".",
"If",
"this",
"is",
"an",
"output",
"buffer",
"also",
"flush",
"the",
"current",
"block",
"before",
"closing",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarBuffer.java#L376-L394 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.removeNodeRecursively | private Node removeNodeRecursively(final NodeImpl node, final ArchivePath path) {
final NodeImpl parentNode = content.get(path.getParent());
if (parentNode != null) {
parentNode.removeChild(node);
}
// Remove from nested archives if present
nestedArchives.remove(path... | java | private Node removeNodeRecursively(final NodeImpl node, final ArchivePath path) {
final NodeImpl parentNode = content.get(path.getParent());
if (parentNode != null) {
parentNode.removeChild(node);
}
// Remove from nested archives if present
nestedArchives.remove(path... | [
"private",
"Node",
"removeNodeRecursively",
"(",
"final",
"NodeImpl",
"node",
",",
"final",
"ArchivePath",
"path",
")",
"{",
"final",
"NodeImpl",
"parentNode",
"=",
"content",
".",
"get",
"(",
"path",
".",
"getParent",
"(",
")",
")",
";",
"if",
"(",
"paren... | Removes the specified node and its associated children from the contents
of this archive.
@param node the node to remove recursively
@param path the path denoting the specified node
@return the removed node itself | [
"Removes",
"the",
"specified",
"node",
"and",
"its",
"associated",
"children",
"from",
"the",
"contents",
"of",
"this",
"archive",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L303-L324 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.nestedContains | private boolean nestedContains(ArchivePath path) {
// Iterate through nested archives
for (Entry<ArchivePath, ArchiveAsset> nestedArchiveEntry : nestedArchives.entrySet()) {
ArchivePath archivePath = nestedArchiveEntry.getKey();
ArchiveAsset archiveAsset = nestedArchiveEntry.getV... | java | private boolean nestedContains(ArchivePath path) {
// Iterate through nested archives
for (Entry<ArchivePath, ArchiveAsset> nestedArchiveEntry : nestedArchives.entrySet()) {
ArchivePath archivePath = nestedArchiveEntry.getKey();
ArchiveAsset archiveAsset = nestedArchiveEntry.getV... | [
"private",
"boolean",
"nestedContains",
"(",
"ArchivePath",
"path",
")",
"{",
"// Iterate through nested archives",
"for",
"(",
"Entry",
"<",
"ArchivePath",
",",
"ArchiveAsset",
">",
"nestedArchiveEntry",
":",
"nestedArchives",
".",
"entrySet",
"(",
")",
")",
"{",
... | Check to see if a path is found in a nested archive | [
"Check",
"to",
"see",
"if",
"a",
"path",
"is",
"found",
"in",
"a",
"nested",
"archive"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L396-L414 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.getNestedNode | private Node getNestedNode(ArchivePath path) {
// Iterate through nested archives
for (Entry<ArchivePath, ArchiveAsset> nestedArchiveEntry : nestedArchives.entrySet()) {
ArchivePath archivePath = nestedArchiveEntry.getKey();
ArchiveAsset archiveAsset = nestedArchiveEntry.getValue... | java | private Node getNestedNode(ArchivePath path) {
// Iterate through nested archives
for (Entry<ArchivePath, ArchiveAsset> nestedArchiveEntry : nestedArchives.entrySet()) {
ArchivePath archivePath = nestedArchiveEntry.getKey();
ArchiveAsset archiveAsset = nestedArchiveEntry.getValue... | [
"private",
"Node",
"getNestedNode",
"(",
"ArchivePath",
"path",
")",
"{",
"// Iterate through nested archives",
"for",
"(",
"Entry",
"<",
"ArchivePath",
",",
"ArchiveAsset",
">",
"nestedArchiveEntry",
":",
"nestedArchives",
".",
"entrySet",
"(",
")",
")",
"{",
"Ar... | Attempt to get the asset from a nested archive.
@param path
@return | [
"Attempt",
"to",
"get",
"the",
"asset",
"from",
"a",
"nested",
"archive",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L422-L440 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.startsWith | private boolean startsWith(ArchivePath fullPath, ArchivePath startingPath) {
final String context = fullPath.get();
final String startingContext = startingPath.get();
return context.startsWith(startingContext);
} | java | private boolean startsWith(ArchivePath fullPath, ArchivePath startingPath) {
final String context = fullPath.get();
final String startingContext = startingPath.get();
return context.startsWith(startingContext);
} | [
"private",
"boolean",
"startsWith",
"(",
"ArchivePath",
"fullPath",
",",
"ArchivePath",
"startingPath",
")",
"{",
"final",
"String",
"context",
"=",
"fullPath",
".",
"get",
"(",
")",
";",
"final",
"String",
"startingContext",
"=",
"startingPath",
".",
"get",
"... | Check to see if one path starts with another
@param fullPath
@param startingPath
@return | [
"Check",
"to",
"see",
"if",
"one",
"path",
"starts",
"with",
"another"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L449-L454 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.getNestedPath | private ArchivePath getNestedPath(ArchivePath fullPath, ArchivePath basePath) {
final String context = fullPath.get();
final String baseContent = basePath.get();
// Remove the base path from the full path
String nestedArchiveContext = context.substring(baseContent.length());
re... | java | private ArchivePath getNestedPath(ArchivePath fullPath, ArchivePath basePath) {
final String context = fullPath.get();
final String baseContent = basePath.get();
// Remove the base path from the full path
String nestedArchiveContext = context.substring(baseContent.length());
re... | [
"private",
"ArchivePath",
"getNestedPath",
"(",
"ArchivePath",
"fullPath",
",",
"ArchivePath",
"basePath",
")",
"{",
"final",
"String",
"context",
"=",
"fullPath",
".",
"get",
"(",
")",
";",
"final",
"String",
"baseContent",
"=",
"basePath",
".",
"get",
"(",
... | Given a full path and a base path return a new path containing the full path with the base path removed from the
beginning.
@param fullPath
@param basePath
@return | [
"Given",
"a",
"full",
"path",
"and",
"a",
"base",
"path",
"return",
"a",
"new",
"path",
"containing",
"the",
"full",
"path",
"with",
"the",
"base",
"path",
"removed",
"from",
"the",
"beginning",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L464-L472 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.initialize | private void initialize() {
this.file = null;
this.header = new TarHeader();
this.gnuFormat = false;
this.ustarFormat = true; // REVIEW What we prefer to use...
this.unixFormat = false;
} | java | private void initialize() {
this.file = null;
this.header = new TarHeader();
this.gnuFormat = false;
this.ustarFormat = true; // REVIEW What we prefer to use...
this.unixFormat = false;
} | [
"private",
"void",
"initialize",
"(",
")",
"{",
"this",
".",
"file",
"=",
"null",
";",
"this",
".",
"header",
"=",
"new",
"TarHeader",
"(",
")",
";",
"this",
".",
"gnuFormat",
"=",
"false",
";",
"this",
".",
"ustarFormat",
"=",
"true",
";",
"// REVIE... | Initialization code common to all constructors. | [
"Initialization",
"code",
"common",
"to",
"all",
"constructors",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L179-L186 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.isDescendent | public boolean isDescendent(TarEntry desc) {
return desc.header.name.toString().startsWith(this.header.name.toString());
} | java | public boolean isDescendent(TarEntry desc) {
return desc.header.name.toString().startsWith(this.header.name.toString());
} | [
"public",
"boolean",
"isDescendent",
"(",
"TarEntry",
"desc",
")",
"{",
"return",
"desc",
".",
"header",
".",
"name",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"this",
".",
"header",
".",
"name",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Determine if the given entry is a descendant of this entry. Descendancy is determined by the name of the
descendant starting with this entry's name.
@param desc
Entry to be checked as a descendent of this.
@return True if entry is a descendant of this. | [
"Determine",
"if",
"the",
"given",
"entry",
"is",
"a",
"descendant",
"of",
"this",
"entry",
".",
"Descendancy",
"is",
"determined",
"by",
"the",
"name",
"of",
"the",
"descendant",
"starting",
"with",
"this",
"entry",
"s",
"name",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L301-L303 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.isDirectory | public boolean isDirectory() {
if (this.file != null) {
return this.file.isDirectory();
}
if (this.header != null) {
if (this.header.linkFlag == TarHeader.LF_DIR) {
return true;
}
if (this.header.name.toString().endsWith... | java | public boolean isDirectory() {
if (this.file != null) {
return this.file.isDirectory();
}
if (this.header != null) {
if (this.header.linkFlag == TarHeader.LF_DIR) {
return true;
}
if (this.header.name.toString().endsWith... | [
"public",
"boolean",
"isDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"file",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"file",
".",
"isDirectory",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"header",
"!=",
"null",
")",
"{",
"if",
"(",... | Return whether or not this entry represents a directory.
@return True if this entry is a directory. | [
"Return",
"whether",
"or",
"not",
"this",
"entry",
"represents",
"a",
"directory",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L498-L514 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.getFileTarHeader | public void getFileTarHeader(TarHeader hdr, File file) throws InvalidHeaderException {
this.file = file;
String name = file.getPath();
String osname = System.getProperty("os.name");
if (osname != null) {
// Strip off drive letters!
// REVIEW Would a better... | java | public void getFileTarHeader(TarHeader hdr, File file) throws InvalidHeaderException {
this.file = file;
String name = file.getPath();
String osname = System.getProperty("os.name");
if (osname != null) {
// Strip off drive letters!
// REVIEW Would a better... | [
"public",
"void",
"getFileTarHeader",
"(",
"TarHeader",
"hdr",
",",
"File",
"file",
")",
"throws",
"InvalidHeaderException",
"{",
"this",
".",
"file",
"=",
"file",
";",
"String",
"name",
"=",
"file",
".",
"getPath",
"(",
")",
";",
"String",
"osname",
"=",
... | Fill in a TarHeader with information from a File.
@param hdr
The TarHeader to fill in.
@param file
The file from which to get the header information. | [
"Fill",
"in",
"a",
"TarHeader",
"with",
"information",
"from",
"a",
"File",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L524-L586 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.getDirectoryEntries | public TarEntry[] getDirectoryEntries() throws InvalidHeaderException {
if (this.file == null || !this.file.isDirectory()) {
return new TarEntry[0];
}
String[] list = this.file.list();
TarEntry[] result = new TarEntry[list.length];
for (int i = 0; i < list... | java | public TarEntry[] getDirectoryEntries() throws InvalidHeaderException {
if (this.file == null || !this.file.isDirectory()) {
return new TarEntry[0];
}
String[] list = this.file.list();
TarEntry[] result = new TarEntry[list.length];
for (int i = 0; i < list... | [
"public",
"TarEntry",
"[",
"]",
"getDirectoryEntries",
"(",
")",
"throws",
"InvalidHeaderException",
"{",
"if",
"(",
"this",
".",
"file",
"==",
"null",
"||",
"!",
"this",
".",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"new",
"TarEntry",
"... | If this entry represents a file, and the file is a directory, return an array of TarEntries for this entry's
children.
@return An array of TarEntry's for this entry's children. | [
"If",
"this",
"entry",
"represents",
"a",
"file",
"and",
"the",
"file",
"is",
"a",
"directory",
"return",
"an",
"array",
"of",
"TarEntries",
"for",
"this",
"entry",
"s",
"children",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L594-L608 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.computeCheckSum | public long computeCheckSum(byte[] buf) {
long sum = 0;
for (int i = 0; i < buf.length; ++i) {
sum += 255 & buf[i];
}
return sum;
} | java | public long computeCheckSum(byte[] buf) {
long sum = 0;
for (int i = 0; i < buf.length; ++i) {
sum += 255 & buf[i];
}
return sum;
} | [
"public",
"long",
"computeCheckSum",
"(",
"byte",
"[",
"]",
"buf",
")",
"{",
"long",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buf",
".",
"length",
";",
"++",
"i",
")",
"{",
"sum",
"+=",
"255",
"&",
"buf",
"[",
... | Compute the checksum of a tar entry header.
@param buf
The tar entry's header buffer.
@return The computed checksum. | [
"Compute",
"the",
"checksum",
"of",
"a",
"tar",
"entry",
"header",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L617-L625 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.writeEntryHeader | public void writeEntryHeader(byte[] outbuf) throws InvalidHeaderException {
int offset = 0;
if (this.isUnixTarFormat()) {
if (this.header.name.length() > 100) {
throw new InvalidHeaderException("file path is greater than 100 characters, " + this.header.name);
... | java | public void writeEntryHeader(byte[] outbuf) throws InvalidHeaderException {
int offset = 0;
if (this.isUnixTarFormat()) {
if (this.header.name.length() > 100) {
throw new InvalidHeaderException("file path is greater than 100 characters, " + this.header.name);
... | [
"public",
"void",
"writeEntryHeader",
"(",
"byte",
"[",
"]",
"outbuf",
")",
"throws",
"InvalidHeaderException",
"{",
"int",
"offset",
"=",
"0",
";",
"if",
"(",
"this",
".",
"isUnixTarFormat",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"header",
".",
"... | Write an entry's header information to a header buffer. This method can throw an InvalidHeaderException
@param outbuf
The tar entry header buffer to fill in.
@throws InvalidHeaderException
If the name will not fit in the header. | [
"Write",
"an",
"entry",
"s",
"header",
"information",
"to",
"a",
"header",
"buffer",
".",
"This",
"method",
"can",
"throw",
"an",
"InvalidHeaderException"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L635-L690 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.nameTarHeader | public void nameTarHeader(TarHeader hdr, String name) {
boolean isDir = name.endsWith("/");
this.gnuFormat = false;
this.ustarFormat = true;
this.unixFormat = false;
hdr.checkSum = 0;
hdr.devMajor = 0;
hdr.devMinor = 0;
hdr.name = new StringB... | java | public void nameTarHeader(TarHeader hdr, String name) {
boolean isDir = name.endsWith("/");
this.gnuFormat = false;
this.ustarFormat = true;
this.unixFormat = false;
hdr.checkSum = 0;
hdr.devMajor = 0;
hdr.devMinor = 0;
hdr.name = new StringB... | [
"public",
"void",
"nameTarHeader",
"(",
"TarHeader",
"hdr",
",",
"String",
"name",
")",
"{",
"boolean",
"isDir",
"=",
"name",
".",
"endsWith",
"(",
"\"/\"",
")",
";",
"this",
".",
"gnuFormat",
"=",
"false",
";",
"this",
".",
"ustarFormat",
"=",
"true",
... | Fill in a TarHeader given only the entry's name.
@param hdr
The TarHeader to fill in.
@param name
The tar entry name. | [
"Fill",
"in",
"a",
"TarHeader",
"given",
"only",
"the",
"entry",
"s",
"name",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L822-L850 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractOnDemandInputStream.java | AbstractOnDemandInputStream.doCopy | private void doCopy() throws IOException {
int copied = IOUtil.copy(currentNodeStream, outputStream, BUFFER_LENGTH);
if (copied == -1) {
currentNodeStream.close();
currentNodeStream = null;
endAsset();
}
} | java | private void doCopy() throws IOException {
int copied = IOUtil.copy(currentNodeStream, outputStream, BUFFER_LENGTH);
if (copied == -1) {
currentNodeStream.close();
currentNodeStream = null;
endAsset();
}
} | [
"private",
"void",
"doCopy",
"(",
")",
"throws",
"IOException",
"{",
"int",
"copied",
"=",
"IOUtil",
".",
"copy",
"(",
"currentNodeStream",
",",
"outputStream",
",",
"BUFFER_LENGTH",
")",
";",
"if",
"(",
"copied",
"==",
"-",
"1",
")",
"{",
"currentNodeStre... | Performs copy operation between currentNodeStream and outputStream using buffer length.
@throws IOException | [
"Performs",
"copy",
"operation",
"between",
"currentNodeStream",
"and",
"outputStream",
"using",
"buffer",
"length",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractOnDemandInputStream.java#L170-L177 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractOnDemandInputStream.java | AbstractOnDemandInputStream.startAsset | private void startAsset(final String path, final Asset asset) throws IOException {
putNextEntry(outputStream, path, asset);
} | java | private void startAsset(final String path, final Asset asset) throws IOException {
putNextEntry(outputStream, path, asset);
} | [
"private",
"void",
"startAsset",
"(",
"final",
"String",
"path",
",",
"final",
"Asset",
"asset",
")",
"throws",
"IOException",
"{",
"putNextEntry",
"(",
"outputStream",
",",
"path",
",",
"asset",
")",
";",
"}"
] | Start entry in stream.
@param path
@throws IOException | [
"Start",
"entry",
"in",
"stream",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractOnDemandInputStream.java#L185-L187 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ExtensionWrapper.java | ExtensionWrapper.getProperty | String getProperty(String key) {
String value = properties.get(key);
if (value == null) {
throw new RuntimeException("No property value found for key " + key);
}
return value;
} | java | String getProperty(String key) {
String value = properties.get(key);
if (value == null) {
throw new RuntimeException("No property value found for key " + key);
}
return value;
} | [
"String",
"getProperty",
"(",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"properties",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"No property value found for key \"",
"+",... | Gets the value for the given key in the properties map. If the property is not found, an exception is thrown.
@param key
the key to look up value for
@return value of the property
@throws RuntimeException
if the property is not found | [
"Gets",
"the",
"value",
"for",
"the",
"given",
"key",
"in",
"the",
"properties",
"map",
".",
"If",
"the",
"property",
"is",
"not",
"found",
"an",
"exception",
"is",
"thrown",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ExtensionWrapper.java#L55-L61 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BZip2CompressorOutputStream.java | BZip2CompressorOutputStream.init | private void init() throws IOException {
bsPutUByte('B');
bsPutUByte('Z');
this.data = new Data(this.blockSize100k);
this.blockSorter = new BlockSort(this.data);
// huffmanised magic bytes
bsPutUByte('h');
bsPutUByte('0' + this.blockSize100k);
this.comb... | java | private void init() throws IOException {
bsPutUByte('B');
bsPutUByte('Z');
this.data = new Data(this.blockSize100k);
this.blockSorter = new BlockSort(this.data);
// huffmanised magic bytes
bsPutUByte('h');
bsPutUByte('0' + this.blockSize100k);
this.comb... | [
"private",
"void",
"init",
"(",
")",
"throws",
"IOException",
"{",
"bsPutUByte",
"(",
"'",
"'",
")",
";",
"bsPutUByte",
"(",
"'",
"'",
")",
";",
"this",
".",
"data",
"=",
"new",
"Data",
"(",
"this",
".",
"blockSize100k",
")",
";",
"this",
".",
"blo... | Writes magic bytes like BZ on the first position of the stream
and bytes indiciating the file-format, which is
huffmanised, followed by a digit indicating blockSize100k.
@throws IOException if the magic bytes could not been written | [
"Writes",
"magic",
"bytes",
"like",
"BZ",
"on",
"the",
"first",
"position",
"of",
"the",
"stream",
"and",
"bytes",
"indiciating",
"the",
"file",
"-",
"format",
"which",
"is",
"huffmanised",
"followed",
"by",
"a",
"digit",
"indicating",
"blockSize100k",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BZip2CompressorOutputStream.java#L530-L543 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BZip2CompressorOutputStream.java | BZip2CompressorOutputStream.write0 | private void write0(int b) throws IOException {
if (this.currentChar != -1) {
b &= 0xff;
if (this.currentChar == b) {
if (++this.runLength > 254) {
writeRun();
this.currentChar = -1;
this.runLength = 0;
... | java | private void write0(int b) throws IOException {
if (this.currentChar != -1) {
b &= 0xff;
if (this.currentChar == b) {
if (++this.runLength > 254) {
writeRun();
this.currentChar = -1;
this.runLength = 0;
... | [
"private",
"void",
"write0",
"(",
"int",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"currentChar",
"!=",
"-",
"1",
")",
"{",
"b",
"&=",
"0xff",
";",
"if",
"(",
"this",
".",
"currentChar",
"==",
"b",
")",
"{",
"if",
"(",
"++",... | Keeps track of the last bytes written and implicitly performs
run-length encoding as the first step of the bzip2 algorithm. | [
"Keeps",
"track",
"of",
"the",
"last",
"bytes",
"written",
"and",
"implicitly",
"performs",
"run",
"-",
"length",
"encoding",
"as",
"the",
"first",
"step",
"of",
"the",
"bzip2",
"algorithm",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BZip2CompressorOutputStream.java#L651-L670 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java | PathUtil.optionallyRemovePrecedingSlash | public static String optionallyRemovePrecedingSlash(final String path) {
// Precondition check
assertSpecified(path);
// Is there's a first character of slash
if (isFirstCharSlash(path)) {
// Return everything but first char
return path.substring(1);
}
... | java | public static String optionallyRemovePrecedingSlash(final String path) {
// Precondition check
assertSpecified(path);
// Is there's a first character of slash
if (isFirstCharSlash(path)) {
// Return everything but first char
return path.substring(1);
}
... | [
"public",
"static",
"String",
"optionallyRemovePrecedingSlash",
"(",
"final",
"String",
"path",
")",
"{",
"// Precondition check",
"assertSpecified",
"(",
"path",
")",
";",
"// Is there's a first character of slash",
"if",
"(",
"isFirstCharSlash",
"(",
"path",
")",
")",... | Removes, if present, the absolute slash preceding the specified path, and returns the adjusted result.
@param path
@return | [
"Removes",
"if",
"present",
"the",
"absolute",
"slash",
"preceding",
"the",
"specified",
"path",
"and",
"returns",
"the",
"adjusted",
"result",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java#L129-L141 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java | PathUtil.optionallyRemoveFollowingSlash | public static String optionallyRemoveFollowingSlash(final String path) {
// Precondition check
assertSpecified(path);
// Is there's a last character of slash
if (isLastCharSlash(path)) {
// Return everything but last char
return path.substring(0, path.length() - ... | java | public static String optionallyRemoveFollowingSlash(final String path) {
// Precondition check
assertSpecified(path);
// Is there's a last character of slash
if (isLastCharSlash(path)) {
// Return everything but last char
return path.substring(0, path.length() - ... | [
"public",
"static",
"String",
"optionallyRemoveFollowingSlash",
"(",
"final",
"String",
"path",
")",
"{",
"// Precondition check",
"assertSpecified",
"(",
"path",
")",
";",
"// Is there's a last character of slash",
"if",
"(",
"isLastCharSlash",
"(",
"path",
")",
")",
... | Removes, if present, the absolute slash following the specified path, and returns the adjusted result.
@param path
@return | [
"Removes",
"if",
"present",
"the",
"absolute",
"slash",
"following",
"the",
"specified",
"path",
"and",
"returns",
"the",
"adjusted",
"result",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java#L149-L161 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java | PathUtil.optionallyAppendSlash | public static String optionallyAppendSlash(final String path) {
// Precondition check
assertSpecified(path);
// If the last character is not a slash
if (!isLastCharSlash(path)) {
// Append
return path + ArchivePath.SEPARATOR;
}
// Return as-is
... | java | public static String optionallyAppendSlash(final String path) {
// Precondition check
assertSpecified(path);
// If the last character is not a slash
if (!isLastCharSlash(path)) {
// Append
return path + ArchivePath.SEPARATOR;
}
// Return as-is
... | [
"public",
"static",
"String",
"optionallyAppendSlash",
"(",
"final",
"String",
"path",
")",
"{",
"// Precondition check",
"assertSpecified",
"(",
"path",
")",
";",
"// If the last character is not a slash",
"if",
"(",
"!",
"isLastCharSlash",
"(",
"path",
")",
")",
"... | Adds, if not already present, the absolute slash following the specified path, and returns the adjusted result.
@param path
@return | [
"Adds",
"if",
"not",
"already",
"present",
"the",
"absolute",
"slash",
"following",
"the",
"specified",
"path",
"and",
"returns",
"the",
"adjusted",
"result",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java#L169-L181 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java | PathUtil.optionallyPrependSlash | public static String optionallyPrependSlash(final String path) {
// Adjust null
String resolved = path;
if (resolved == null) {
resolved = EMPTY;
}
// If the first character is not a slash
if (!isFirstCharSlash(resolved)) {
// Prepend the slash
... | java | public static String optionallyPrependSlash(final String path) {
// Adjust null
String resolved = path;
if (resolved == null) {
resolved = EMPTY;
}
// If the first character is not a slash
if (!isFirstCharSlash(resolved)) {
// Prepend the slash
... | [
"public",
"static",
"String",
"optionallyPrependSlash",
"(",
"final",
"String",
"path",
")",
"{",
"// Adjust null",
"String",
"resolved",
"=",
"path",
";",
"if",
"(",
"resolved",
"==",
"null",
")",
"{",
"resolved",
"=",
"EMPTY",
";",
"}",
"// If the first char... | Adds, if not already present, the absolute slash preceding the specified path, and returns the adjusted result.
If the argument is null, adjusts to an empty String before processing.
@param path
@return | [
"Adds",
"if",
"not",
"already",
"present",
"the",
"absolute",
"slash",
"preceding",
"the",
"specified",
"path",
"and",
"returns",
"the",
"adjusted",
"result",
".",
"If",
"the",
"argument",
"is",
"null",
"adjusts",
"to",
"an",
"empty",
"String",
"before",
"pr... | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java#L190-L205 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java | PathUtil.isFirstCharSlash | private static boolean isFirstCharSlash(final String path) {
assertSpecified(path);
if (path.length() == 0) {
return false;
}
return path.charAt(0) == ArchivePath.SEPARATOR;
} | java | private static boolean isFirstCharSlash(final String path) {
assertSpecified(path);
if (path.length() == 0) {
return false;
}
return path.charAt(0) == ArchivePath.SEPARATOR;
} | [
"private",
"static",
"boolean",
"isFirstCharSlash",
"(",
"final",
"String",
"path",
")",
"{",
"assertSpecified",
"(",
"path",
")",
";",
"if",
"(",
"path",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"return",
"path",
".",... | Returns whether or not the first character in the specified String is a slash | [
"Returns",
"whether",
"or",
"not",
"the",
"first",
"character",
"in",
"the",
"specified",
"String",
"is",
"a",
"slash"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/path/PathUtil.java#L242-L248 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.initialize | private void initialize(int recordSize) {
this.rootPath = null;
this.pathPrefix = null;
this.tempPath = System.getProperty("user.dir");
this.userId = 0;
this.userName = "";
this.groupId = 0;
this.groupName = "";
this.debug = false;
thi... | java | private void initialize(int recordSize) {
this.rootPath = null;
this.pathPrefix = null;
this.tempPath = System.getProperty("user.dir");
this.userId = 0;
this.userName = "";
this.groupId = 0;
this.groupName = "";
this.debug = false;
thi... | [
"private",
"void",
"initialize",
"(",
"int",
"recordSize",
")",
"{",
"this",
".",
"rootPath",
"=",
"null",
";",
"this",
".",
"pathPrefix",
"=",
"null",
";",
"this",
".",
"tempPath",
"=",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
";",
"this"... | Common constructor initialization code. | [
"Common",
"constructor",
"initialization",
"code",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L118-L134 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.setDebug | public void setDebug(boolean debugF) {
this.debug = debugF;
if (this.tarIn != null) {
this.tarIn.setDebug(debugF);
} else if (this.tarOut != null) {
this.tarOut.setDebug(debugF);
}
} | java | public void setDebug(boolean debugF) {
this.debug = debugF;
if (this.tarIn != null) {
this.tarIn.setDebug(debugF);
} else if (this.tarOut != null) {
this.tarOut.setDebug(debugF);
}
} | [
"public",
"void",
"setDebug",
"(",
"boolean",
"debugF",
")",
"{",
"this",
".",
"debug",
"=",
"debugF",
";",
"if",
"(",
"this",
".",
"tarIn",
"!=",
"null",
")",
"{",
"this",
".",
"tarIn",
".",
"setDebug",
"(",
"debugF",
")",
";",
"}",
"else",
"if",
... | Set the debugging flag.
@param debugF
The new debug setting. | [
"Set",
"the",
"debugging",
"flag",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L143-L150 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.setUserInfo | public void setUserInfo(int userId, String userName, int groupId, String groupName) {
this.userId = userId;
this.userName = userName;
this.groupId = groupId;
this.groupName = groupName;
} | java | public void setUserInfo(int userId, String userName, int groupId, String groupName) {
this.userId = userId;
this.userName = userName;
this.groupId = groupId;
this.groupName = groupName;
} | [
"public",
"void",
"setUserInfo",
"(",
"int",
"userId",
",",
"String",
"userName",
",",
"int",
"groupId",
",",
"String",
"groupName",
")",
"{",
"this",
".",
"userId",
"=",
"userId",
";",
"this",
".",
"userName",
"=",
"userName",
";",
"this",
".",
"groupId... | Set user and group information that will be used to fill in the tar archive's entry headers. Since Java currently
provides no means of determining a user name, user id, group name, or group id for a given File, TarArchive
allows the programmer to specify values to be used in their place.
@param userId
The user Id to u... | [
"Set",
"user",
"and",
"group",
"information",
"that",
"will",
"be",
"used",
"to",
"fill",
"in",
"the",
"tar",
"archive",
"s",
"entry",
"headers",
".",
"Since",
"Java",
"currently",
"provides",
"no",
"means",
"of",
"determining",
"a",
"user",
"name",
"user"... | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L239-L244 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.getRecordSize | public int getRecordSize() {
if (this.tarIn != null) {
return this.tarIn.getRecordSize();
} else if (this.tarOut != null) {
return this.tarOut.getRecordSize();
}
return TarBuffer.DEFAULT_RCDSIZE;
} | java | public int getRecordSize() {
if (this.tarIn != null) {
return this.tarIn.getRecordSize();
} else if (this.tarOut != null) {
return this.tarOut.getRecordSize();
}
return TarBuffer.DEFAULT_RCDSIZE;
} | [
"public",
"int",
"getRecordSize",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tarIn",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"tarIn",
".",
"getRecordSize",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"tarOut",
"!=",
"null",
")",
"{",
... | Get the archive's record size. Because of its history, tar supports the concept of buffered IO consisting of
BLOCKS of RECORDS. This allowed tar to match the IO characteristics of the physical device being used. Of course,
in the Java world, this makes no sense, WITH ONE EXCEPTION - archives are expected to be propertl... | [
"Get",
"the",
"archive",
"s",
"record",
"size",
".",
"Because",
"of",
"its",
"history",
"tar",
"supports",
"the",
"concept",
"of",
"buffered",
"IO",
"consisting",
"of",
"BLOCKS",
"of",
"RECORDS",
".",
"This",
"allowed",
"tar",
"to",
"match",
"the",
"IO",
... | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L318-L326 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.getTempFilePath | private String getTempFilePath(File eFile) {
String pathStr = this.tempPath + File.separator + eFile.getName() + ".tmp";
for (int i = 1; i < 5; ++i) {
File f = new File(pathStr);
if (!f.exists()) {
break;
}
pathStr = this.tempP... | java | private String getTempFilePath(File eFile) {
String pathStr = this.tempPath + File.separator + eFile.getName() + ".tmp";
for (int i = 1; i < 5; ++i) {
File f = new File(pathStr);
if (!f.exists()) {
break;
}
pathStr = this.tempP... | [
"private",
"String",
"getTempFilePath",
"(",
"File",
"eFile",
")",
"{",
"String",
"pathStr",
"=",
"this",
".",
"tempPath",
"+",
"File",
".",
"separator",
"+",
"eFile",
".",
"getName",
"(",
")",
"+",
"\".tmp\"",
";",
"for",
"(",
"int",
"i",
"=",
"1",
... | Get a path for a temporary file for a given File. The temporary file is NOT created. The algorithm attempts to
handle filename collisions so that the name is unique.
@return The temporary file's path. | [
"Get",
"a",
"path",
"for",
"a",
"temporary",
"file",
"for",
"a",
"given",
"File",
".",
"The",
"temporary",
"file",
"is",
"NOT",
"created",
".",
"The",
"algorithm",
"attempts",
"to",
"handle",
"filename",
"collisions",
"so",
"that",
"the",
"name",
"is",
"... | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L335-L349 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.listContents | public void listContents() throws IOException {
for (;;) {
TarEntry entry = this.tarIn.getNextEntry();
if (entry == null) {
if (this.debug) {
System.err.println("READ EOF RECORD");
}
break;
}
... | java | public void listContents() throws IOException {
for (;;) {
TarEntry entry = this.tarIn.getNextEntry();
if (entry == null) {
if (this.debug) {
System.err.println("READ EOF RECORD");
}
break;
}
... | [
"public",
"void",
"listContents",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
";",
";",
")",
"{",
"TarEntry",
"entry",
"=",
"this",
".",
"tarIn",
".",
"getNextEntry",
"(",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"if",
"(",
"th... | Perform the "list" command and list the contents of the archive. NOTE That this method uses the progress display
to actually list the conents. If the progress display is not set, nothing will be listed! | [
"Perform",
"the",
"list",
"command",
"and",
"list",
"the",
"contents",
"of",
"the",
"archive",
".",
"NOTE",
"That",
"this",
"method",
"uses",
"the",
"progress",
"display",
"to",
"actually",
"list",
"the",
"conents",
".",
"If",
"the",
"progress",
"display",
... | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L368-L383 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java | TarArchive.extractContents | public void extractContents(File destDir) throws IOException {
for (;;) {
TarEntry entry = this.tarIn.getNextEntry();
if (entry == null) {
if (this.debug) {
System.err.println("READ EOF RECORD");
}
break;
... | java | public void extractContents(File destDir) throws IOException {
for (;;) {
TarEntry entry = this.tarIn.getNextEntry();
if (entry == null) {
if (this.debug) {
System.err.println("READ EOF RECORD");
}
break;
... | [
"public",
"void",
"extractContents",
"(",
"File",
"destDir",
")",
"throws",
"IOException",
"{",
"for",
"(",
";",
";",
")",
"{",
"TarEntry",
"entry",
"=",
"this",
".",
"tarIn",
".",
"getNextEntry",
"(",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
... | Perform the "extract" command and extract the contents of the archive.
@param destDir
The destination directory into which to extract. | [
"Perform",
"the",
"extract",
"command",
"and",
"extract",
"the",
"contents",
"of",
"the",
"archive",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L392-L405 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BlockSort.java | BlockSort.fswap | private void fswap(int[] fmap, int zz1, int zz2) {
int zztmp = fmap[zz1];
fmap[zz1] = fmap[zz2];
fmap[zz2] = zztmp;
} | java | private void fswap(int[] fmap, int zz1, int zz2) {
int zztmp = fmap[zz1];
fmap[zz1] = fmap[zz2];
fmap[zz2] = zztmp;
} | [
"private",
"void",
"fswap",
"(",
"int",
"[",
"]",
"fmap",
",",
"int",
"zz1",
",",
"int",
"zz2",
")",
"{",
"int",
"zztmp",
"=",
"fmap",
"[",
"zz1",
"]",
";",
"fmap",
"[",
"zz1",
"]",
"=",
"fmap",
"[",
"zz2",
"]",
";",
"fmap",
"[",
"zz2",
"]",
... | swaps two values in fmap | [
"swaps",
"two",
"values",
"in",
"fmap"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BlockSort.java#L307-L311 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BlockSort.java | BlockSort.fvswap | private void fvswap(int[] fmap, int yyp1, int yyp2, int yyn) {
while (yyn > 0) {
fswap(fmap, yyp1, yyp2);
yyp1++; yyp2++; yyn--;
}
} | java | private void fvswap(int[] fmap, int yyp1, int yyp2, int yyn) {
while (yyn > 0) {
fswap(fmap, yyp1, yyp2);
yyp1++; yyp2++; yyn--;
}
} | [
"private",
"void",
"fvswap",
"(",
"int",
"[",
"]",
"fmap",
",",
"int",
"yyp1",
",",
"int",
"yyp2",
",",
"int",
"yyn",
")",
"{",
"while",
"(",
"yyn",
">",
"0",
")",
"{",
"fswap",
"(",
"fmap",
",",
"yyp1",
",",
"yyp2",
")",
";",
"yyp1",
"++",
"... | swaps two intervals starting at yyp1 and yyp2 of length yyn inside fmap. | [
"swaps",
"two",
"intervals",
"starting",
"at",
"yyp1",
"and",
"yyp2",
"of",
"length",
"yyn",
"inside",
"fmap",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BlockSort.java#L316-L321 | train |
shrinkwrap/shrinkwrap | api/src/main/java/org/jboss/shrinkwrap/api/ConfigurationBuilder.java | ConfigurationBuilder.setDefaults | void setDefaults() {
// If no ClassLoaders are specified, use the TCCL
// Ensure we default this BEFORE defaulting the extension loader, as
// the loader needs a CL to be created
if (this.getClassLoaders() == null) {
final ClassLoader tccl = SecurityActions.getThreadContextCl... | java | void setDefaults() {
// If no ClassLoaders are specified, use the TCCL
// Ensure we default this BEFORE defaulting the extension loader, as
// the loader needs a CL to be created
if (this.getClassLoaders() == null) {
final ClassLoader tccl = SecurityActions.getThreadContextCl... | [
"void",
"setDefaults",
"(",
")",
"{",
"// If no ClassLoaders are specified, use the TCCL",
"// Ensure we default this BEFORE defaulting the extension loader, as",
"// the loader needs a CL to be created",
"if",
"(",
"this",
".",
"getClassLoaders",
"(",
")",
"==",
"null",
")",
"{"... | Sets properties to their default values if they haven't been explicitly provided by the user. If no ClassLoaders
are specified, use the TCCL. | [
"Sets",
"properties",
"to",
"their",
"default",
"values",
"if",
"they",
"haven",
"t",
"been",
"explicitly",
"provided",
"by",
"the",
"user",
".",
"If",
"no",
"ClassLoaders",
"are",
"specified",
"use",
"the",
"TCCL",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/api/src/main/java/org/jboss/shrinkwrap/api/ConfigurationBuilder.java#L167-L211 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BZip2CompressorInputStream.java | BZip2CompressorInputStream.matches | public static boolean matches(byte[] signature, int length) {
if (length < 3) {
return false;
}
if (signature[0] != 'B') {
return false;
}
if (signature[1] != 'Z') {
return false;
}
if (signature[2] != 'h') {
ret... | java | public static boolean matches(byte[] signature, int length) {
if (length < 3) {
return false;
}
if (signature[0] != 'B') {
return false;
}
if (signature[1] != 'Z') {
return false;
}
if (signature[2] != 'h') {
ret... | [
"public",
"static",
"boolean",
"matches",
"(",
"byte",
"[",
"]",
"signature",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<",
"3",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"signature",
"[",
"0",
"]",
"!=",
"'",
"'",
")",
"{",
... | Checks if the signature matches what is expected for a bzip2 file.
@param signature
the bytes to check
@param length
the number of bytes to check
@return true, if this stream is a bzip2 compressed stream, false otherwise
@since 1.1 | [
"Checks",
"if",
"the",
"signature",
"matches",
"what",
"is",
"expected",
"for",
"a",
"bzip2",
"file",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BZip2CompressorInputStream.java#L1080-L1099 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/URLPackageScanner.java | URLPackageScanner.newInstance | public static URLPackageScanner newInstance(boolean addRecursively, final ClassLoader classLoader,
final Callback callback, final String packageName) {
Validate.notNull(packageName, "Package name must be specified");
Validate.notNull(addRecursively, "AddRe... | java | public static URLPackageScanner newInstance(boolean addRecursively, final ClassLoader classLoader,
final Callback callback, final String packageName) {
Validate.notNull(packageName, "Package name must be specified");
Validate.notNull(addRecursively, "AddRe... | [
"public",
"static",
"URLPackageScanner",
"newInstance",
"(",
"boolean",
"addRecursively",
",",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"Callback",
"callback",
",",
"final",
"String",
"packageName",
")",
"{",
"Validate",
".",
"notNull",
"(",
"packageName... | Factory method to create an instance of URLPackageScanner.
@param addRecursively flag to add child packages
@param classLoader class loader that will have classes added
@param callback Callback to invoke when a matching class is found
@param packageName Package that will be scanned
@return new instance of ... | [
"Factory",
"method",
"to",
"create",
"an",
"instance",
"of",
"URLPackageScanner",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/URLPackageScanner.java#L79-L87 | train |
shrinkwrap/shrinkwrap | api/src/main/java/org/jboss/shrinkwrap/api/asset/ByteArrayIOUtil.java | ByteArrayIOUtil.asByteArray | static byte[] asByteArray(final InputStream in) throws IllegalArgumentException {
// Precondition check
if (in == null) {
throw new IllegalArgumentException("stream must be specified");
}
// Get content as an array of bytes
final ByteArrayOutputStream out = new ByteA... | java | static byte[] asByteArray(final InputStream in) throws IllegalArgumentException {
// Precondition check
if (in == null) {
throw new IllegalArgumentException("stream must be specified");
}
// Get content as an array of bytes
final ByteArrayOutputStream out = new ByteA... | [
"static",
"byte",
"[",
"]",
"asByteArray",
"(",
"final",
"InputStream",
"in",
")",
"throws",
"IllegalArgumentException",
"{",
"// Precondition check",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"stream must be specifi... | Obtains the contents of the specified stream as a byte array
@param in
InputStream
@throws IllegalArgumentException
If the stream was not specified
@return the byte[] for the given InputStream | [
"Obtains",
"the",
"contents",
"of",
"the",
"specified",
"stream",
"as",
"a",
"byte",
"array"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/api/src/main/java/org/jboss/shrinkwrap/api/asset/ByteArrayIOUtil.java#L44-L77 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java | IOUtil.asUTF8String | public static String asUTF8String(InputStream in) {
// Precondition check
Validate.notNull(in, "Stream must be specified");
StringBuilder buffer = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UT... | java | public static String asUTF8String(InputStream in) {
// Precondition check
Validate.notNull(in, "Stream must be specified");
StringBuilder buffer = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UT... | [
"public",
"static",
"String",
"asUTF8String",
"(",
"InputStream",
"in",
")",
"{",
"// Precondition check",
"Validate",
".",
"notNull",
"(",
"in",
",",
"\"Stream must be specified\"",
")",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
... | Obtains the contents of the specified stream as a String in UTF-8 charset.
@param in
@throws IllegalArgumentException
If the stream was not specified | [
"Obtains",
"the",
"contents",
"of",
"the",
"specified",
"stream",
"as",
"a",
"String",
"in",
"UTF",
"-",
"8",
"charset",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L99-L124 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java | IOUtil.bufferedWriteWithFlush | public static void bufferedWriteWithFlush(final OutputStream output, final byte[] content) throws IOException {
final int size = 4096;
int offset = 0;
while (content.length - offset > size) {
output.write(content, offset, size);
offset += size;
}
output.wr... | java | public static void bufferedWriteWithFlush(final OutputStream output, final byte[] content) throws IOException {
final int size = 4096;
int offset = 0;
while (content.length - offset > size) {
output.write(content, offset, size);
offset += size;
}
output.wr... | [
"public",
"static",
"void",
"bufferedWriteWithFlush",
"(",
"final",
"OutputStream",
"output",
",",
"final",
"byte",
"[",
"]",
"content",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"4096",
";",
"int",
"offset",
"=",
"0",
";",
"while",
"... | Writing the specified contents to the specified OutputStream using an internal buffer. Flushing the stream when
completed. Caller is responsible for opening and closing the specified stream.
@param output
The OutputStream
@param content
The content to write to the specified stream
@throws IOException
If a problem occu... | [
"Writing",
"the",
"specified",
"contents",
"to",
"the",
"specified",
"OutputStream",
"using",
"an",
"internal",
"buffer",
".",
"Flushing",
"the",
"stream",
"when",
"completed",
".",
"Caller",
"is",
"responsible",
"for",
"opening",
"and",
"closing",
"the",
"speci... | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L182-L191 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java | IOUtil.copyWithClose | public static void copyWithClose(InputStream input, OutputStream output) throws IOException {
try {
copy(input, output);
} finally {
try {
input.close();
} catch (final IOException ignore) {
if (log.isLoggable(Level.FINER)) {
... | java | public static void copyWithClose(InputStream input, OutputStream output) throws IOException {
try {
copy(input, output);
} finally {
try {
input.close();
} catch (final IOException ignore) {
if (log.isLoggable(Level.FINER)) {
... | [
"public",
"static",
"void",
"copyWithClose",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"try",
"{",
"copy",
"(",
"input",
",",
"output",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"input",
".",
"close",
... | Copies the contents from an InputStream to an OutputStream and closes both streams.
@param input
@param output
@throws IOException
If a problem occurred during any I/O operations during the copy, but on closing the streams these
will be ignored and logged at {@link Level#FINER} | [
"Copies",
"the",
"contents",
"from",
"an",
"InputStream",
"to",
"an",
"OutputStream",
"and",
"closes",
"both",
"streams",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L202-L221 | train |
shrinkwrap/shrinkwrap | api/src/main/java/org/jboss/shrinkwrap/api/asset/FileAsset.java | FileAsset.openStream | @Override
public InputStream openStream() {
try {
return new BufferedInputStream(new FileInputStream(file), 8192);
} catch (FileNotFoundException e) {
throw new RuntimeException("Could not open file " + file, e);
}
} | java | @Override
public InputStream openStream() {
try {
return new BufferedInputStream(new FileInputStream(file), 8192);
} catch (FileNotFoundException e) {
throw new RuntimeException("Could not open file " + file, e);
}
} | [
"@",
"Override",
"public",
"InputStream",
"openStream",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"8192",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"t... | Opens a new FileInputStream for the given File.
Can throw a Runtime exception if the file has been deleted in between the FileResource was created and the stream
is opened.
@throws RuntimeException
If the file is not found. | [
"Opens",
"a",
"new",
"FileInputStream",
"for",
"the",
"given",
"File",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/api/src/main/java/org/jboss/shrinkwrap/api/asset/FileAsset.java#L63-L70 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.parseOctal | public static long parseOctal(byte[] header, int offset, int length) throws InvalidHeaderException {
long result = 0;
boolean stillPadding = true;
int end = offset + length;
for (int i = offset; i < end; ++i) {
if (header[i] == 0) {
break;
... | java | public static long parseOctal(byte[] header, int offset, int length) throws InvalidHeaderException {
long result = 0;
boolean stillPadding = true;
int end = offset + length;
for (int i = offset; i < end; ++i) {
if (header[i] == 0) {
break;
... | [
"public",
"static",
"long",
"parseOctal",
"(",
"byte",
"[",
"]",
"header",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"InvalidHeaderException",
"{",
"long",
"result",
"=",
"0",
";",
"boolean",
"stillPadding",
"=",
"true",
";",
"int",
"end",... | Parse an octal string from a header buffer. This is used for the file permission mode value.
@param header
The header buffer from which to parse.
@param offset
The offset into the buffer from which to parse.
@param length
The number of header bytes to parse.
@return The long value of the octal string. | [
"Parse",
"an",
"octal",
"string",
"from",
"a",
"header",
"buffer",
".",
"This",
"is",
"used",
"for",
"the",
"file",
"permission",
"mode",
"value",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L256-L282 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.parseName | public static StringBuffer parseName(byte[] header, int offset, int length) throws InvalidHeaderException {
StringBuffer result = new StringBuffer(length);
int end = offset + length;
for (int i = offset; i < end; ++i) {
if (header[i] == 0) {
break;
... | java | public static StringBuffer parseName(byte[] header, int offset, int length) throws InvalidHeaderException {
StringBuffer result = new StringBuffer(length);
int end = offset + length;
for (int i = offset; i < end; ++i) {
if (header[i] == 0) {
break;
... | [
"public",
"static",
"StringBuffer",
"parseName",
"(",
"byte",
"[",
"]",
"header",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"InvalidHeaderException",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"length",
")",
";",
"int",
... | Parse an entry name from a header buffer.
@param header
The header buffer from which to parse.
@param offset
The offset into the buffer from which to parse.
@param length
The number of header bytes to parse.
@return The header's entry name. | [
"Parse",
"an",
"entry",
"name",
"from",
"a",
"header",
"buffer",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L331-L343 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.getNameBytes | public static int getNameBytes(StringBuffer name, byte[] buf, int offset, int length) {
int i;
for (i = 0; i < length && i < name.length(); ++i) {
buf[offset + i] = (byte) name.charAt(i);
}
for (; i < length; ++i) {
buf[offset + i] = 0;
}
... | java | public static int getNameBytes(StringBuffer name, byte[] buf, int offset, int length) {
int i;
for (i = 0; i < length && i < name.length(); ++i) {
buf[offset + i] = (byte) name.charAt(i);
}
for (; i < length; ++i) {
buf[offset + i] = 0;
}
... | [
"public",
"static",
"int",
"getNameBytes",
"(",
"StringBuffer",
"name",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"length",
"&&",
"i",
"<",
"name... | Move the bytes from the name StringBuffer into the header's buffer.
@param header
The header buffer into which to copy the name.
@param offset
The offset into the buffer at which to store.
@param length
The number of header bytes to store.
@return The new offset (offset + length). | [
"Move",
"the",
"bytes",
"from",
"the",
"name",
"StringBuffer",
"into",
"the",
"header",
"s",
"buffer",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L400-L412 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.getOctalBytes | public static int getOctalBytes(long value, byte[] buf, int offset, int length) {
int idx = length - 1;
buf[offset + idx] = 0;
--idx;
buf[offset + idx] = (byte) ' ';
--idx;
if (value == 0) {
buf[offset + idx] = (byte) '0';
--idx;
... | java | public static int getOctalBytes(long value, byte[] buf, int offset, int length) {
int idx = length - 1;
buf[offset + idx] = 0;
--idx;
buf[offset + idx] = (byte) ' ';
--idx;
if (value == 0) {
buf[offset + idx] = (byte) '0';
--idx;
... | [
"public",
"static",
"int",
"getOctalBytes",
"(",
"long",
"value",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"idx",
"=",
"length",
"-",
"1",
";",
"buf",
"[",
"offset",
"+",
"idx",
"]",
"=",
"0",
";"... | Parse an octal integer from a header buffer.
@param header
The header buffer from which to parse.
@param offset
The offset into the buffer from which to parse.
@param length
The number of header bytes to parse.
@return The integer value of the octal bytes. | [
"Parse",
"an",
"octal",
"integer",
"from",
"a",
"header",
"buffer",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L425-L448 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.getCheckSumOctalBytes | public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length) {
TarHeader.getOctalBytes(value, buf, offset, length);
buf[offset + length - 1] = (byte) ' ';
buf[offset + length - 2] = 0;
return offset + length;
} | java | public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length) {
TarHeader.getOctalBytes(value, buf, offset, length);
buf[offset + length - 1] = (byte) ' ';
buf[offset + length - 2] = 0;
return offset + length;
} | [
"public",
"static",
"int",
"getCheckSumOctalBytes",
"(",
"long",
"value",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"TarHeader",
".",
"getOctalBytes",
"(",
"value",
",",
"buf",
",",
"offset",
",",
"length",
")",
... | Parse the checksum octal integer from a header buffer.
@param header
The header buffer from which to parse.
@param offset
The offset into the buffer from which to parse.
@param length
The number of header bytes to parse.
@return The integer value of the entry's checksum. | [
"Parse",
"the",
"checksum",
"octal",
"integer",
"from",
"a",
"header",
"buffer",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L479-L484 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapFileSystem.java | ShrinkWrapFileSystem.merge | private String merge(final String first, final String[] more) {
assert first != null : "first must be specified";
assert more != null : "more must be specified";
final StringBuilder merged = new StringBuilder();
merged.append(first);
for (int i = 0; i < more.length; i++) {
... | java | private String merge(final String first, final String[] more) {
assert first != null : "first must be specified";
assert more != null : "more must be specified";
final StringBuilder merged = new StringBuilder();
merged.append(first);
for (int i = 0; i < more.length; i++) {
... | [
"private",
"String",
"merge",
"(",
"final",
"String",
"first",
",",
"final",
"String",
"[",
"]",
"more",
")",
"{",
"assert",
"first",
"!=",
"null",
":",
"\"first must be specified\"",
";",
"assert",
"more",
"!=",
"null",
":",
"\"more must be specified\"",
";",... | Merges the path context with a varargs String sub-contexts, returning the result
@param first
@param more
@return | [
"Merges",
"the",
"path",
"context",
"with",
"a",
"varargs",
"String",
"sub",
"-",
"contexts",
"returning",
"the",
"result"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapFileSystem.java#L203-L215 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveBase.java | ArchiveBase.covariantReturn | protected final T covariantReturn() {
try {
return this.getActualClass().cast(this);
} catch (final ClassCastException cce) {
log.log(Level.SEVERE,
"The class specified by getActualClass is not a valid assignment target for this instance;"
+ " ... | java | protected final T covariantReturn() {
try {
return this.getActualClass().cast(this);
} catch (final ClassCastException cce) {
log.log(Level.SEVERE,
"The class specified by getActualClass is not a valid assignment target for this instance;"
+ " ... | [
"protected",
"final",
"T",
"covariantReturn",
"(",
")",
"{",
"try",
"{",
"return",
"this",
".",
"getActualClass",
"(",
")",
".",
"cast",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"final",
"ClassCastException",
"cce",
")",
"{",
"log",
".",
"log",
"(",
... | Provides typesafe covariant return of this instance | [
"Provides",
"typesafe",
"covariant",
"return",
"of",
"this",
"instance"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveBase.java#L810-L819 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java | ShrinkWrapPath.toAbsolutePath | @Override
public Path toAbsolutePath() {
// Already absolute?
if (this.isAbsolute()) {
return this;
}
// Else construct a new absolute path and normalize it
final Path absolutePath = new ShrinkWrapPath(ArchivePath.SEPARATOR + this.path, this.fileSystem);
... | java | @Override
public Path toAbsolutePath() {
// Already absolute?
if (this.isAbsolute()) {
return this;
}
// Else construct a new absolute path and normalize it
final Path absolutePath = new ShrinkWrapPath(ArchivePath.SEPARATOR + this.path, this.fileSystem);
... | [
"@",
"Override",
"public",
"Path",
"toAbsolutePath",
"(",
")",
"{",
"// Already absolute?",
"if",
"(",
"this",
".",
"isAbsolute",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"// Else construct a new absolute path and normalize it",
"final",
"Path",
"absolutePath... | Resolves relative paths against the root directory, normalizing as well.
@see java.nio.file.Path#toAbsolutePath() | [
"Resolves",
"relative",
"paths",
"against",
"the",
"root",
"directory",
"normalizing",
"as",
"well",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java#L508-L520 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java | ShrinkWrapPath.tokenize | private static List<String> tokenize(final ShrinkWrapPath path) {
final StringTokenizer tokenizer = new StringTokenizer(path.toString(), ArchivePath.SEPARATOR_STRING);
final List<String> tokens = new ArrayList<>();
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken())... | java | private static List<String> tokenize(final ShrinkWrapPath path) {
final StringTokenizer tokenizer = new StringTokenizer(path.toString(), ArchivePath.SEPARATOR_STRING);
final List<String> tokens = new ArrayList<>();
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken())... | [
"private",
"static",
"List",
"<",
"String",
">",
"tokenize",
"(",
"final",
"ShrinkWrapPath",
"path",
")",
"{",
"final",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
"(",
"path",
".",
"toString",
"(",
")",
",",
"ArchivePath",
".",
"SEPARATOR_S... | Returns the components of this path in order from root out
@return | [
"Returns",
"the",
"components",
"of",
"this",
"path",
"in",
"order",
"from",
"root",
"out"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java#L633-L640 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java | ShrinkWrapPath.normalize | private static String normalize(final List<String> path, boolean absolute) {
assert path != null : "path must be specified";
// Remove unnecessary references to this dir
if (path.contains(DIR_THIS)) {
path.remove(DIR_THIS);
normalize(path, absolute);
}
/... | java | private static String normalize(final List<String> path, boolean absolute) {
assert path != null : "path must be specified";
// Remove unnecessary references to this dir
if (path.contains(DIR_THIS)) {
path.remove(DIR_THIS);
normalize(path, absolute);
}
/... | [
"private",
"static",
"String",
"normalize",
"(",
"final",
"List",
"<",
"String",
">",
"path",
",",
"boolean",
"absolute",
")",
"{",
"assert",
"path",
"!=",
"null",
":",
"\"path must be specified\"",
";",
"// Remove unnecessary references to this dir",
"if",
"(",
"... | Normalizes the tokenized view of the path
@param path
@return | [
"Normalizes",
"the",
"tokenized",
"view",
"of",
"the",
"path"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java#L648-L681 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java | ShrinkWrapPath.relativizeCommonRoot | private static ShrinkWrapPath relativizeCommonRoot(final ShrinkWrapPath thisOriginal, final Path thisCurrent,
final Path otherOriginal, Path otherCurrent, final int backupCount) {
// Preconditions
assert thisOriginal != null;
assert thisCurrent != null;
assert otherOriginal != nu... | java | private static ShrinkWrapPath relativizeCommonRoot(final ShrinkWrapPath thisOriginal, final Path thisCurrent,
final Path otherOriginal, Path otherCurrent, final int backupCount) {
// Preconditions
assert thisOriginal != null;
assert thisCurrent != null;
assert otherOriginal != nu... | [
"private",
"static",
"ShrinkWrapPath",
"relativizeCommonRoot",
"(",
"final",
"ShrinkWrapPath",
"thisOriginal",
",",
"final",
"Path",
"thisCurrent",
",",
"final",
"Path",
"otherOriginal",
",",
"Path",
"otherCurrent",
",",
"final",
"int",
"backupCount",
")",
"{",
"// ... | Relativizes the paths recursively
@param thisOriginal
@param thisCurrent
@param otherOriginal
@param otherCurrent
@param backupCount
@return | [
"Relativizes",
"the",
"paths",
"recursively"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java#L693-L742 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java | AbstractExporterDelegate.doExport | protected void doExport() {
// Get archive
final Archive<?> archive = getArchive();
if (log.isLoggable(Level.FINE)) {
log.fine("Exporting archive - " + archive.getName());
}
// Obtain the root
final Node rootNode = archive.get(ArchivePaths.root());
/... | java | protected void doExport() {
// Get archive
final Archive<?> archive = getArchive();
if (log.isLoggable(Level.FINE)) {
log.fine("Exporting archive - " + archive.getName());
}
// Obtain the root
final Node rootNode = archive.get(ArchivePaths.root());
/... | [
"protected",
"void",
"doExport",
"(",
")",
"{",
"// Get archive",
"final",
"Archive",
"<",
"?",
">",
"archive",
"=",
"getArchive",
"(",
")",
";",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
... | Primary method providing a template for exporting the contents of an archive | [
"Primary",
"method",
"providing",
"a",
"template",
"for",
"exporting",
"the",
"contents",
"of",
"an",
"archive"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java#L83-L97 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java | AbstractExporterDelegate.processNode | private void processNode(final Node node) {
processNode(node.getPath(), node);
Set<Node> children = node.getChildren();
for (Node child : children) {
processNode(child);
}
} | java | private void processNode(final Node node) {
processNode(node.getPath(), node);
Set<Node> children = node.getChildren();
for (Node child : children) {
processNode(child);
}
} | [
"private",
"void",
"processNode",
"(",
"final",
"Node",
"node",
")",
"{",
"processNode",
"(",
"node",
".",
"getPath",
"(",
")",
",",
"node",
")",
";",
"Set",
"<",
"Node",
">",
"children",
"=",
"node",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
... | Recursive call to process all the node hierarchy
@param node | [
"Recursive",
"call",
"to",
"process",
"all",
"the",
"node",
"hierarchy"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java#L104-L111 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java | ExplodedExporterDelegate.processArchiveAsset | private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset) {
// Get the nested archive
Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory);
} | java | private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset) {
// Get the nested archive
Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory);
} | [
"private",
"void",
"processArchiveAsset",
"(",
"File",
"parentDirectory",
",",
"ArchiveAsset",
"nestedArchiveAsset",
")",
"{",
"// Get the nested archive",
"Archive",
"<",
"?",
">",
"nestedArchive",
"=",
"nestedArchiveAsset",
".",
"getArchive",
"(",
")",
";",
"nestedA... | Processes a nested archive by delegating to the ExplodedArchiveExporter
@param parentDirectory
@param nestedArchiveAsset | [
"Processes",
"a",
"nested",
"archive",
"by",
"delegating",
"to",
"the",
"ExplodedArchiveExporter"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java#L165-L169 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java | ExplodedExporterDelegate.validateOutputDirectory | private File validateOutputDirectory(File outputDirectory) {
// Create output directory
if (!outputDirectory.mkdir() && !outputDirectory.exists()) {
throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory);
}
if (outputDirectory.isFil... | java | private File validateOutputDirectory(File outputDirectory) {
// Create output directory
if (!outputDirectory.mkdir() && !outputDirectory.exists()) {
throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory);
}
if (outputDirectory.isFil... | [
"private",
"File",
"validateOutputDirectory",
"(",
"File",
"outputDirectory",
")",
"{",
"// Create output directory",
"if",
"(",
"!",
"outputDirectory",
".",
"mkdir",
"(",
")",
"&&",
"!",
"outputDirectory",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"A... | Initializes the output directory
@param baseDirectory
@param directoryName
@return | [
"Initializes",
"the",
"output",
"directory"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java#L178-L189 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapFileSystemProvider.java | ShrinkWrapFileSystemProvider.getArchive | private Archive<?> getArchive(final Path path) {
assert path != null : "Path must be specified";
final FileSystem fs = path.getFileSystem();
assert fs != null : "File system is null";
// Could be user error in this case, passing in a Path from another provider
if (!(fs instanceof... | java | private Archive<?> getArchive(final Path path) {
assert path != null : "Path must be specified";
final FileSystem fs = path.getFileSystem();
assert fs != null : "File system is null";
// Could be user error in this case, passing in a Path from another provider
if (!(fs instanceof... | [
"private",
"Archive",
"<",
"?",
">",
"getArchive",
"(",
"final",
"Path",
"path",
")",
"{",
"assert",
"path",
"!=",
"null",
":",
"\"Path must be specified\"",
";",
"final",
"FileSystem",
"fs",
"=",
"path",
".",
"getFileSystem",
"(",
")",
";",
"assert",
"fs"... | Obtains the underlying archive associated with the specified Path
@param path
@return | [
"Obtains",
"the",
"underlying",
"archive",
"associated",
"with",
"the",
"specified",
"Path"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapFileSystemProvider.java#L409-L422 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java | ContainerBase.fileFromResource | private File fileFromResource(final String resourceName) throws IllegalArgumentException {
final URL resourceUrl = AccessController.doPrivileged(GetTcclAction.INSTANCE).getResource(resourceName);
Validate.notNull(resourceUrl, resourceName + " doesn't exist or can't be accessed");
String resourc... | java | private File fileFromResource(final String resourceName) throws IllegalArgumentException {
final URL resourceUrl = AccessController.doPrivileged(GetTcclAction.INSTANCE).getResource(resourceName);
Validate.notNull(resourceUrl, resourceName + " doesn't exist or can't be accessed");
String resourc... | [
"private",
"File",
"fileFromResource",
"(",
"final",
"String",
"resourceName",
")",
"throws",
"IllegalArgumentException",
"{",
"final",
"URL",
"resourceUrl",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"GetTcclAction",
".",
"INSTANCE",
")",
".",
"getResource",
... | Gets a resource from the TCCL and returns its file path.
@param resourceName
is the name of the resource in the classpath
@return the file path for resourceName @see {@link java.net.URL#getFile()}
@throws IllegalArgumentException
if resourceName doesn't exist in the classpath or privileges are not granted | [
"Gets",
"a",
"resource",
"from",
"the",
"TCCL",
"and",
"returns",
"its",
"file",
"path",
"."
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java#L1989-L2001 | train |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/serialization/ZipSerializableViewImpl.java | ZipSerializableViewImpl.writeObject | private void writeObject(final ObjectOutputStream out) throws IOException {
// Default write of non-transient fields
out.defaultWriteObject();
// Write as ZIP
final InputStream in = archive.as(ZipExporter.class).exportAsInputStream();
try {
IOUtil.copy(in, out); // D... | java | private void writeObject(final ObjectOutputStream out) throws IOException {
// Default write of non-transient fields
out.defaultWriteObject();
// Write as ZIP
final InputStream in = archive.as(ZipExporter.class).exportAsInputStream();
try {
IOUtil.copy(in, out); // D... | [
"private",
"void",
"writeObject",
"(",
"final",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"// Default write of non-transient fields",
"out",
".",
"defaultWriteObject",
"(",
")",
";",
"// Write as ZIP",
"final",
"InputStream",
"in",
"=",
"archive",
... | Serializes the invocation with a custom form
@serialData After all non-transient fields are written, we send the {@link Archive} contents encoded as ZIP. | [
"Serializes",
"the",
"invocation",
"with",
"a",
"custom",
"form"
] | 3f8a1a6d344651428c709a63ebb52d35343c5387 | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/serialization/ZipSerializableViewImpl.java#L120-L139 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/PercentExpression.java | PercentExpression.decimalFormat | private Format decimalFormat(int fractionPrecision) {
DecimalFormat format;
if (fractionPrecision == 0) {
format = new DecimalFormat("###0");
} else if (fractionPrecision > 0) {
StringBuilder formatSb = new StringBuilder();
formatSb.append("###0.");
appendChars(formatSb, ZERO_CHARS, fractionPrecision)... | java | private Format decimalFormat(int fractionPrecision) {
DecimalFormat format;
if (fractionPrecision == 0) {
format = new DecimalFormat("###0");
} else if (fractionPrecision > 0) {
StringBuilder formatSb = new StringBuilder();
formatSb.append("###0.");
appendChars(formatSb, ZERO_CHARS, fractionPrecision)... | [
"private",
"Format",
"decimalFormat",
"(",
"int",
"fractionPrecision",
")",
"{",
"DecimalFormat",
"format",
";",
"if",
"(",
"fractionPrecision",
"==",
"0",
")",
"{",
"format",
"=",
"new",
"DecimalFormat",
"(",
"\"###0\"",
")",
";",
"}",
"else",
"if",
"(",
... | -d.ddd+-dd style, if no precision then 6 digits, 'inf', nan', if 0 precision then "" | [
"-",
"d",
".",
"ddd",
"+",
"-",
"dd",
"style",
"if",
"no",
"precision",
"then",
"6",
"digits",
"inf",
"nan",
"if",
"0",
"precision",
"then"
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/PercentExpression.java#L348-L361 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/types/PStringType.java | PStringType.extractValueFromBytes | @Override
public Object extractValueFromBytes(int offset, byte[] bytes, boolean required) {
// we don't need to extract the value if all we are doing is matching
if (!required) {
return EMPTY;
}
if (offset >= bytes.length) {
return null;
}
// length is from the first byte of the string
int len = (b... | java | @Override
public Object extractValueFromBytes(int offset, byte[] bytes, boolean required) {
// we don't need to extract the value if all we are doing is matching
if (!required) {
return EMPTY;
}
if (offset >= bytes.length) {
return null;
}
// length is from the first byte of the string
int len = (b... | [
"@",
"Override",
"public",
"Object",
"extractValueFromBytes",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"bytes",
",",
"boolean",
"required",
")",
"{",
"// we don't need to extract the value if all we are doing is matching",
"if",
"(",
"!",
"required",
")",
"{",
"... | Extracted value is the extracted string using the first byte as the length. | [
"Extracted",
"value",
"is",
"the",
"extracted",
"string",
"using",
"the",
"first",
"byte",
"as",
"the",
"length",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/types/PStringType.java#L14-L37 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/MagicEntries.java | MagicEntries.readEntries | public void readEntries(BufferedReader lineReader, ErrorCallBack errorCallBack) throws IOException {
final MagicEntry[] levelParents = new MagicEntry[MAX_LEVELS];
MagicEntry previousEntry = null;
while (true) {
String line = lineReader.readLine();
if (line == null) {
break;
}
// skip blanks and co... | java | public void readEntries(BufferedReader lineReader, ErrorCallBack errorCallBack) throws IOException {
final MagicEntry[] levelParents = new MagicEntry[MAX_LEVELS];
MagicEntry previousEntry = null;
while (true) {
String line = lineReader.readLine();
if (line == null) {
break;
}
// skip blanks and co... | [
"public",
"void",
"readEntries",
"(",
"BufferedReader",
"lineReader",
",",
"ErrorCallBack",
"errorCallBack",
")",
"throws",
"IOException",
"{",
"final",
"MagicEntry",
"[",
"]",
"levelParents",
"=",
"new",
"MagicEntry",
"[",
"MAX_LEVELS",
"]",
";",
"MagicEntry",
"p... | Read the entries so later we can find matches with them. | [
"Read",
"the",
"entries",
"so",
"later",
"we",
"can",
"find",
"matches",
"with",
"them",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/MagicEntries.java#L31-L82 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/MagicEntries.java | MagicEntries.optimizeFirstBytes | public void optimizeFirstBytes() {
// now we post process the entries and remove the first byte ones we can optimize
for (MagicEntry entry : entryList) {
byte[] startingBytes = entry.getStartsWithByte();
if (startingBytes == null || startingBytes.length == 0) {
continue;
}
int index = (0xFF & starti... | java | public void optimizeFirstBytes() {
// now we post process the entries and remove the first byte ones we can optimize
for (MagicEntry entry : entryList) {
byte[] startingBytes = entry.getStartsWithByte();
if (startingBytes == null || startingBytes.length == 0) {
continue;
}
int index = (0xFF & starti... | [
"public",
"void",
"optimizeFirstBytes",
"(",
")",
"{",
"// now we post process the entries and remove the first byte ones we can optimize",
"for",
"(",
"MagicEntry",
"entry",
":",
"entryList",
")",
"{",
"byte",
"[",
"]",
"startingBytes",
"=",
"entry",
".",
"getStartsWithB... | Optimize the magic entries by removing the first-bytes information into their own lists | [
"Optimize",
"the",
"magic",
"entries",
"by",
"removing",
"the",
"first",
"-",
"bytes",
"information",
"into",
"their",
"own",
"lists"
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/MagicEntries.java#L87-L104 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/MagicEntries.java | MagicEntries.findMatch | public ContentInfo findMatch(byte[] bytes) {
if (bytes.length == 0) {
return ContentInfo.EMPTY_INFO;
}
// first do the start byte ones
int index = (0xFF & bytes[0]);
if (index < firstByteEntryLists.length && firstByteEntryLists[index] != null) {
ContentInfo info = findMatch(bytes, firstByteEntryLists[in... | java | public ContentInfo findMatch(byte[] bytes) {
if (bytes.length == 0) {
return ContentInfo.EMPTY_INFO;
}
// first do the start byte ones
int index = (0xFF & bytes[0]);
if (index < firstByteEntryLists.length && firstByteEntryLists[index] != null) {
ContentInfo info = findMatch(bytes, firstByteEntryLists[in... | [
"public",
"ContentInfo",
"findMatch",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
"==",
"0",
")",
"{",
"return",
"ContentInfo",
".",
"EMPTY_INFO",
";",
"}",
"// first do the start byte ones",
"int",
"index",
"=",
"(",
"0xFF... | Find and return a match for the associated bytes. | [
"Find",
"and",
"return",
"a",
"match",
"for",
"the",
"associated",
"bytes",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/MagicEntries.java#L109-L123 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/MagicFormatter.java | MagicFormatter.format | public void format(StringBuilder sb, Object value) {
if (prefix != null) {
sb.append(prefix);
}
if (percentExpression != null && value != null) {
percentExpression.append(value, sb);
}
if (suffix != null) {
sb.append(suffix);
}
} | java | public void format(StringBuilder sb, Object value) {
if (prefix != null) {
sb.append(prefix);
}
if (percentExpression != null && value != null) {
percentExpression.append(value, sb);
}
if (suffix != null) {
sb.append(suffix);
}
} | [
"public",
"void",
"format",
"(",
"StringBuilder",
"sb",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"prefix",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"prefix",
")",
";",
"}",
"if",
"(",
"percentExpression",
"!=",
"null",
"&&",
"value",
"!=... | Formats the extracted value assigned and returns the associated string | [
"Formats",
"the",
"extracted",
"value",
"assigned",
"and",
"returns",
"the",
"associated",
"string"
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/MagicFormatter.java#L78-L88 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/ContentInfoUtil.java | ContentInfoUtil.findMatch | public ContentInfo findMatch(File file) throws IOException {
int readSize = fileReadSize;
if (!file.exists()) {
throw new IOException("File does not exist: " + file);
}
if (!file.canRead()) {
throw new IOException("File is not readable: " + file);
}
long length = file.length();
if (length <= 0) {
... | java | public ContentInfo findMatch(File file) throws IOException {
int readSize = fileReadSize;
if (!file.exists()) {
throw new IOException("File does not exist: " + file);
}
if (!file.canRead()) {
throw new IOException("File is not readable: " + file);
}
long length = file.length();
if (length <= 0) {
... | [
"public",
"ContentInfo",
"findMatch",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"int",
"readSize",
"=",
"fileReadSize",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"File does not exist: ... | Return the content type for the file or null if none of the magic entries matched.
@throws IOException
If there was a problem reading from the file. | [
"Return",
"the",
"content",
"type",
"for",
"the",
"file",
"or",
"null",
"if",
"none",
"of",
"the",
"magic",
"entries",
"matched",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/ContentInfoUtil.java#L201-L231 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/ContentInfoUtil.java | ContentInfoUtil.findMatch | public ContentInfo findMatch(byte[] bytes) {
if (bytes.length == 0) {
return ContentInfo.EMPTY_INFO;
} else {
return magicEntries.findMatch(bytes);
}
} | java | public ContentInfo findMatch(byte[] bytes) {
if (bytes.length == 0) {
return ContentInfo.EMPTY_INFO;
} else {
return magicEntries.findMatch(bytes);
}
} | [
"public",
"ContentInfo",
"findMatch",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
"==",
"0",
")",
"{",
"return",
"ContentInfo",
".",
"EMPTY_INFO",
";",
"}",
"else",
"{",
"return",
"magicEntries",
".",
"findMatch",
"(",
... | Return the content type from the associated bytes or null if none of the magic entries matched. | [
"Return",
"the",
"content",
"type",
"from",
"the",
"associated",
"bytes",
"or",
"null",
"if",
"none",
"of",
"the",
"magic",
"entries",
"matched",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/ContentInfoUtil.java#L262-L268 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/ContentInfoUtil.java | ContentInfoUtil.findExtensionMatch | public static ContentInfo findExtensionMatch(String name) {
name = name.toLowerCase();
// look up the whole name first
ContentType type = ContentType.fromFileExtension(name);
if (type != ContentType.OTHER) {
return new ContentInfo(type);
}
// now find the .ext part, if any
int index = name.lastIndexO... | java | public static ContentInfo findExtensionMatch(String name) {
name = name.toLowerCase();
// look up the whole name first
ContentType type = ContentType.fromFileExtension(name);
if (type != ContentType.OTHER) {
return new ContentInfo(type);
}
// now find the .ext part, if any
int index = name.lastIndexO... | [
"public",
"static",
"ContentInfo",
"findExtensionMatch",
"(",
"String",
"name",
")",
"{",
"name",
"=",
"name",
".",
"toLowerCase",
"(",
")",
";",
"// look up the whole name first",
"ContentType",
"type",
"=",
"ContentType",
".",
"fromFileExtension",
"(",
"name",
"... | Return the content type if the extension from the file-name matches our internal list. This can either be just
the extension part or it will look for the last period and take the string after that as the extension.
@return The matching content-info or null if no matches. | [
"Return",
"the",
"content",
"type",
"if",
"the",
"extension",
"from",
"the",
"file",
"-",
"name",
"matches",
"our",
"internal",
"list",
".",
"This",
"can",
"either",
"be",
"just",
"the",
"extension",
"part",
"or",
"it",
"will",
"look",
"for",
"the",
"las... | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/ContentInfoUtil.java#L276-L297 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/ContentInfoUtil.java | ContentInfoUtil.findMimeTypeMatch | public static ContentInfo findMimeTypeMatch(String mimeType) {
ContentType type = ContentType.fromMimeType(mimeType.toLowerCase());
if (type == ContentType.OTHER) {
return null;
} else {
return new ContentInfo(type);
}
} | java | public static ContentInfo findMimeTypeMatch(String mimeType) {
ContentType type = ContentType.fromMimeType(mimeType.toLowerCase());
if (type == ContentType.OTHER) {
return null;
} else {
return new ContentInfo(type);
}
} | [
"public",
"static",
"ContentInfo",
"findMimeTypeMatch",
"(",
"String",
"mimeType",
")",
"{",
"ContentType",
"type",
"=",
"ContentType",
".",
"fromMimeType",
"(",
"mimeType",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"type",
"==",
"ContentType",
".",
... | Return the content type if the mime-type matches our internal list.
@return The matching content-info or null if no matches. | [
"Return",
"the",
"content",
"type",
"if",
"the",
"mime",
"-",
"type",
"matches",
"our",
"internal",
"list",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/ContentInfoUtil.java#L304-L311 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/logger/LocalLog.java | LocalLog.readLevelResourceFile | static List<PatternLevel> readLevelResourceFile(InputStream stream) {
List<PatternLevel> levels = null;
if (stream != null) {
try {
levels = configureClassLevels(stream);
} catch (IOException e) {
System.err.println(
"IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + ... | java | static List<PatternLevel> readLevelResourceFile(InputStream stream) {
List<PatternLevel> levels = null;
if (stream != null) {
try {
levels = configureClassLevels(stream);
} catch (IOException e) {
System.err.println(
"IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + ... | [
"static",
"List",
"<",
"PatternLevel",
">",
"readLevelResourceFile",
"(",
"InputStream",
"stream",
")",
"{",
"List",
"<",
"PatternLevel",
">",
"levels",
"=",
"null",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"try",
"{",
"levels",
"=",
"configureCla... | Read in our levels from our configuration file. | [
"Read",
"in",
"our",
"levels",
"from",
"our",
"configuration",
"file",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/logger/LocalLog.java#L143-L160 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/IanaEntries.java | IanaEntries.loadFile | private void loadFile(String resourcePath) {
InputStream stream = getClass().getResourceAsStream(resourcePath);
if (stream == null) {
throw new IllegalArgumentException(resourcePath + " is missing");
}
BufferedReader lineReader = null;
try {
lineReader = new BufferedReader(new InputStreamReader(new GZIP... | java | private void loadFile(String resourcePath) {
InputStream stream = getClass().getResourceAsStream(resourcePath);
if (stream == null) {
throw new IllegalArgumentException(resourcePath + " is missing");
}
BufferedReader lineReader = null;
try {
lineReader = new BufferedReader(new InputStreamReader(new GZIP... | [
"private",
"void",
"loadFile",
"(",
"String",
"resourcePath",
")",
"{",
"InputStream",
"stream",
"=",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"resourcePath",
")",
";",
"if",
"(",
"stream",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgume... | Loads the IANA database from the specified file. | [
"Loads",
"the",
"IANA",
"database",
"from",
"the",
"specified",
"file",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/IanaEntries.java#L53-L96 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/MagicEntry.java | MagicEntry.matchBytes | ContentInfo matchBytes(byte[] bytes) {
ContentData data = matchBytes(bytes, 0, 0, null);
if (data == null || data.name == MagicEntryParser.UNKNOWN_NAME) {
return null;
} else {
return new ContentInfo(data.name, data.mimeType, data.sb.toString(), data.partial);
}
} | java | ContentInfo matchBytes(byte[] bytes) {
ContentData data = matchBytes(bytes, 0, 0, null);
if (data == null || data.name == MagicEntryParser.UNKNOWN_NAME) {
return null;
} else {
return new ContentInfo(data.name, data.mimeType, data.sb.toString(), data.partial);
}
} | [
"ContentInfo",
"matchBytes",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"ContentData",
"data",
"=",
"matchBytes",
"(",
"bytes",
",",
"0",
",",
"0",
",",
"null",
")",
";",
"if",
"(",
"data",
"==",
"null",
"||",
"data",
".",
"name",
"==",
"MagicEntryPar... | Returns the content type associated with the bytes or null if it does not match. | [
"Returns",
"the",
"content",
"type",
"associated",
"with",
"the",
"bytes",
"or",
"null",
"if",
"it",
"does",
"not",
"match",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/MagicEntry.java#L64-L71 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/entries/MagicEntry.java | MagicEntry.matchBytes | private ContentData matchBytes(byte[] bytes, int prevOffset, int level, ContentData contentData) {
int offset = this.offset;
if (offsetInfo != null) {
// offset can be null if we run out of bytes
Integer maybeOffset = offsetInfo.getOffset(bytes);
if (maybeOffset == null) {
return null;
}
offset =... | java | private ContentData matchBytes(byte[] bytes, int prevOffset, int level, ContentData contentData) {
int offset = this.offset;
if (offsetInfo != null) {
// offset can be null if we run out of bytes
Integer maybeOffset = offsetInfo.getOffset(bytes);
if (maybeOffset == null) {
return null;
}
offset =... | [
"private",
"ContentData",
"matchBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"prevOffset",
",",
"int",
"level",
",",
"ContentData",
"contentData",
")",
"{",
"int",
"offset",
"=",
"this",
".",
"offset",
";",
"if",
"(",
"offsetInfo",
"!=",
"null",
"... | Main processing method which can go recursive. | [
"Main",
"processing",
"method",
"which",
"can",
"go",
"recursive",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/entries/MagicEntry.java#L130-L213 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/types/PatternUtils.java | PatternUtils.preProcessPattern | public static String preProcessPattern(String pattern) {
int index = pattern.indexOf('\\');
if (index < 0) {
return pattern;
}
StringBuilder sb = new StringBuilder();
for (int pos = 0; pos < pattern.length();) {
char ch = pattern.charAt(pos);
if (ch != '\\') {
sb.append(ch);
pos++;
conti... | java | public static String preProcessPattern(String pattern) {
int index = pattern.indexOf('\\');
if (index < 0) {
return pattern;
}
StringBuilder sb = new StringBuilder();
for (int pos = 0; pos < pattern.length();) {
char ch = pattern.charAt(pos);
if (ch != '\\') {
sb.append(ch);
pos++;
conti... | [
"public",
"static",
"String",
"preProcessPattern",
"(",
"String",
"pattern",
")",
"{",
"int",
"index",
"=",
"pattern",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"pattern",
";",
"}",
"StringBuilder",
"sb"... | Pre-processes the pattern by handling backslash escapes such as \b and \007. | [
"Pre",
"-",
"processes",
"the",
"pattern",
"by",
"handling",
"backslash",
"escapes",
"such",
"as",
"\\",
"b",
"and",
"\\",
"007",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/types/PatternUtils.java#L13-L87 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/types/LongType.java | LongType.staticCompare | public static int staticCompare(Number extractedValue, Number testValue) {
long extractedLong = extractedValue.longValue();
long testLong = testValue.longValue();
if (extractedLong > testLong) {
return 1;
} else if (extractedLong < testLong) {
return -1;
} else {
return 0;
}
} | java | public static int staticCompare(Number extractedValue, Number testValue) {
long extractedLong = extractedValue.longValue();
long testLong = testValue.longValue();
if (extractedLong > testLong) {
return 1;
} else if (extractedLong < testLong) {
return -1;
} else {
return 0;
}
} | [
"public",
"static",
"int",
"staticCompare",
"(",
"Number",
"extractedValue",
",",
"Number",
"testValue",
")",
"{",
"long",
"extractedLong",
"=",
"extractedValue",
".",
"longValue",
"(",
")",
";",
"long",
"testLong",
"=",
"testValue",
".",
"longValue",
"(",
")"... | Static compare of longs which are unsigned or signed. | [
"Static",
"compare",
"of",
"longs",
"which",
"are",
"unsigned",
"or",
"signed",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/types/LongType.java#L39-L49 | train |
j256/simplemagic | src/main/java/com/j256/simplemagic/types/StringType.java | StringType.findOffsetMatch | protected String findOffsetMatch(TestInfo info, int startOffset, MutableOffset mutableOffset, final byte[] bytes,
final char[] chars, final int maxPos) {
// verify the starting offset
if (startOffset < 0) {
return null;
}
int targetPos = startOffset;
boolean lastMagicCompactWhitespace = false;
for (... | java | protected String findOffsetMatch(TestInfo info, int startOffset, MutableOffset mutableOffset, final byte[] bytes,
final char[] chars, final int maxPos) {
// verify the starting offset
if (startOffset < 0) {
return null;
}
int targetPos = startOffset;
boolean lastMagicCompactWhitespace = false;
for (... | [
"protected",
"String",
"findOffsetMatch",
"(",
"TestInfo",
"info",
",",
"int",
"startOffset",
",",
"MutableOffset",
"mutableOffset",
",",
"final",
"byte",
"[",
"]",
"bytes",
",",
"final",
"char",
"[",
"]",
"chars",
",",
"final",
"int",
"maxPos",
")",
"{",
... | Find offset match either in an array of bytes or chars, which ever is not null. | [
"Find",
"offset",
"match",
"either",
"in",
"an",
"array",
"of",
"bytes",
"or",
"chars",
"which",
"ever",
"is",
"not",
"null",
"."
] | 360362b52be76e31d01182abffe73f25e170221d | https://github.com/j256/simplemagic/blob/360362b52be76e31d01182abffe73f25e170221d/src/main/java/com/j256/simplemagic/types/StringType.java#L111-L190 | train |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/text/OrderPreservingFilteredIterator.java | OrderPreservingFilteredIterator.next | public String next() {
if (next == null) {
throw new NoSuchElementException();
}
String s = next;
advance();
return s;
} | java | public String next() {
if (next == null) {
throw new NoSuchElementException();
}
String s = next;
advance();
return s;
} | [
"public",
"String",
"next",
"(",
")",
"{",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"String",
"s",
"=",
"next",
";",
"advance",
"(",
")",
";",
"return",
"s",
";",
"}"
] | Returns the next word from the reader that has passed the filter. | [
"Returns",
"the",
"next",
"word",
"from",
"the",
"reader",
"that",
"has",
"passed",
"the",
"filter",
"."
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/text/OrderPreservingFilteredIterator.java#L110-L117 | train |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/tools/ChildesParser.java | ChildesParser.print | private synchronized void print(String output) {
if (generateOneDoc)
writer.print(output);
else
writer.println(output);
} | java | private synchronized void print(String output) {
if (generateOneDoc)
writer.print(output);
else
writer.println(output);
} | [
"private",
"synchronized",
"void",
"print",
"(",
"String",
"output",
")",
"{",
"if",
"(",
"generateOneDoc",
")",
"writer",
".",
"print",
"(",
"output",
")",
";",
"else",
"writer",
".",
"println",
"(",
"output",
")",
";",
"}"
] | Writes strings to the resulting file. | [
"Writes",
"strings",
"to",
"the",
"resulting",
"file",
"."
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/ChildesParser.java#L130-L135 | train |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/tools/ChildesParser.java | ChildesParser.finish | public void finish() {
for (Map.Entry<String, String> entry : posTags.entrySet()) {
posWriter.println(entry.getKey() + " " + entry.getValue());
}
posWriter.flush();
posWriter.close();
writer.flush();
writer.close();
} | java | public void finish() {
for (Map.Entry<String, String> entry : posTags.entrySet()) {
posWriter.println(entry.getKey() + " " + entry.getValue());
}
posWriter.flush();
posWriter.close();
writer.flush();
writer.close();
} | [
"public",
"void",
"finish",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"posTags",
".",
"entrySet",
"(",
")",
")",
"{",
"posWriter",
".",
"println",
"(",
"entry",
".",
"getKey",
"(",
")",
"+",
... | Finalizes the writing of documents. | [
"Finalizes",
"the",
"writing",
"of",
"documents",
"."
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/ChildesParser.java#L273-L282 | train |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/tools/ChildesParser.java | ChildesParser.findXmlFiles | public static void findXmlFiles(ChildesParser parser,
boolean utterancePerDoc,
File directory) {
File[] files = directory.listFiles();
for (File file : files) {
if (file.isDirectory())
findXmlFiles(parser... | java | public static void findXmlFiles(ChildesParser parser,
boolean utterancePerDoc,
File directory) {
File[] files = directory.listFiles();
for (File file : files) {
if (file.isDirectory())
findXmlFiles(parser... | [
"public",
"static",
"void",
"findXmlFiles",
"(",
"ChildesParser",
"parser",
",",
"boolean",
"utterancePerDoc",
",",
"File",
"directory",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"File",
"file",
":"... | Recursively finds any xml documents to parse. | [
"Recursively",
"finds",
"any",
"xml",
"documents",
"to",
"parse",
"."
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/ChildesParser.java#L374-L384 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.