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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/InputElementStack.java | InputElementStack.addDefaultAttribute | @Override
public int addDefaultAttribute(String localName, String uri, String prefix,
String value) throws XMLStreamException
{
return mAttrCollector.addDefaultAttribute(localName, uri, prefix, value);
} | java | @Override
public int addDefaultAttribute(String localName, String uri, String prefix,
String value) throws XMLStreamException
{
return mAttrCollector.addDefaultAttribute(localName, uri, prefix, value);
} | [
"@",
"Override",
"public",
"int",
"addDefaultAttribute",
"(",
"String",
"localName",
",",
"String",
"uri",
",",
"String",
"prefix",
",",
"String",
"value",
")",
"throws",
"XMLStreamException",
"{",
"return",
"mAttrCollector",
".",
"addDefaultAttribute",
"(",
"loca... | Method called by actual validator instances when attributes with
default values have no explicit values for the element; if so,
default value needs to be added as if it was parsed from the
element. | [
"Method",
"called",
"by",
"actual",
"validator",
"instances",
"when",
"attributes",
"with",
"default",
"values",
"have",
"no",
"explicit",
"values",
"for",
"the",
"element",
";",
"if",
"so",
"default",
"value",
"needs",
"to",
"be",
"added",
"as",
"if",
"it",... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/InputElementStack.java#L858-L863 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/ChoiceModel.java | ChoiceModel.cloneModel | @Override
public ModelNode cloneModel()
{
int len = mSubModels.length;
ModelNode[] newModels = new ModelNode[len];
for (int i = 0; i < len; ++i) {
newModels[i] = mSubModels[i].cloneModel();
}
return new ChoiceModel(newModels);
} | java | @Override
public ModelNode cloneModel()
{
int len = mSubModels.length;
ModelNode[] newModels = new ModelNode[len];
for (int i = 0; i < len; ++i) {
newModels[i] = mSubModels[i].cloneModel();
}
return new ChoiceModel(newModels);
} | [
"@",
"Override",
"public",
"ModelNode",
"cloneModel",
"(",
")",
"{",
"int",
"len",
"=",
"mSubModels",
".",
"length",
";",
"ModelNode",
"[",
"]",
"newModels",
"=",
"new",
"ModelNode",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Method that has to create a deep copy of the model, without
sharing any of existing Objects. | [
"Method",
"that",
"has",
"to",
"create",
"a",
"deep",
"copy",
"of",
"the",
"model",
"without",
"sharing",
"any",
"of",
"existing",
"Objects",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/ChoiceModel.java#L62-L71 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/RepairingNsStreamWriter.java | RepairingNsStreamWriter.findOrCreateAttrPrefix | protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI,
SimpleOutputElement elem)
throws XMLStreamException
{
if (nsURI == null || nsURI.length() == 0) {
/* Attributes never use the default namespace; missing
... | java | protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI,
SimpleOutputElement elem)
throws XMLStreamException
{
if (nsURI == null || nsURI.length() == 0) {
/* Attributes never use the default namespace; missing
... | [
"protected",
"final",
"String",
"findOrCreateAttrPrefix",
"(",
"String",
"suggPrefix",
",",
"String",
"nsURI",
",",
"SimpleOutputElement",
"elem",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"nsURI",
"==",
"null",
"||",
"nsURI",
".",
"length",
"(",
")",... | Method called to somehow find a prefix for given namespace, to be
used for a new start element; either use an existing one, or
generate a new one. If a new mapping needs to be generated,
it will also be automatically bound, and necessary namespace
declaration output.
@param suggPrefix Suggested prefix to bind, if any;... | [
"Method",
"called",
"to",
"somehow",
"find",
"a",
"prefix",
"for",
"given",
"namespace",
"to",
"be",
"used",
"for",
"a",
"new",
"start",
"element",
";",
"either",
"use",
"an",
"existing",
"one",
"or",
"generate",
"a",
"new",
"one",
".",
"If",
"a",
"new... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/RepairingNsStreamWriter.java#L553-L626 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/stax/WstxInputFactory.java | WstxInputFactory.createXMLStreamReader | @Override
public XMLStreamReader2 createXMLStreamReader(File f)
throws XMLStreamException
{
/* true for auto-close, since caller has no access to the underlying
* input stream created from the File
*/
return createSR(f, false, true);
} | java | @Override
public XMLStreamReader2 createXMLStreamReader(File f)
throws XMLStreamException
{
/* true for auto-close, since caller has no access to the underlying
* input stream created from the File
*/
return createSR(f, false, true);
} | [
"@",
"Override",
"public",
"XMLStreamReader2",
"createXMLStreamReader",
"(",
"File",
"f",
")",
"throws",
"XMLStreamException",
"{",
"/* true for auto-close, since caller has no access to the underlying\n * input stream created from the File\n */",
"return",
"createSR",
... | Convenience factory method that allows for parsing a document
stored in the specified file. | [
"Convenience",
"factory",
"method",
"that",
"allows",
"for",
"parsing",
"a",
"document",
"stored",
"in",
"the",
"specified",
"file",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxInputFactory.java#L491-L499 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDSubsetImpl.java | DTDSubsetImpl.combineWithExternalSubset | @Override
public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset)
throws XMLStreamException
{
/* First let's see if we can just reuse GE Map used by int or ext
* subset; (if only one has contents), or if not, combine them.
*/
HashMap<St... | java | @Override
public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset)
throws XMLStreamException
{
/* First let's see if we can just reuse GE Map used by int or ext
* subset; (if only one has contents), or if not, combine them.
*/
HashMap<St... | [
"@",
"Override",
"public",
"DTDSubset",
"combineWithExternalSubset",
"(",
"InputProblemReporter",
"rep",
",",
"DTDSubset",
"extSubset",
")",
"throws",
"XMLStreamException",
"{",
"/* First let's see if we can just reuse GE Map used by int or ext\n * subset; (if only one has cont... | Method that will combine definitions from internal and external subsets,
producing a single DTD set. | [
"Method",
"that",
"will",
"combine",
"definitions",
"from",
"internal",
"and",
"external",
"subsets",
"producing",
"a",
"single",
"DTD",
"set",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDSubsetImpl.java#L198-L260 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sax/WstxSAXParser.java | WstxSAXParser.dtdNotationDecl | @Override
public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL)
throws XMLStreamException
{
if (mDTDHandler != null) {
/* 24-Nov-2006, TSa: Note: SAX expects system identifiers to
* be fully resolved when reported...
*/
... | java | @Override
public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL)
throws XMLStreamException
{
if (mDTDHandler != null) {
/* 24-Nov-2006, TSa: Note: SAX expects system identifiers to
* be fully resolved when reported...
*/
... | [
"@",
"Override",
"public",
"void",
"dtdNotationDecl",
"(",
"String",
"name",
",",
"String",
"publicId",
",",
"String",
"systemId",
",",
"URL",
"baseURL",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"mDTDHandler",
"!=",
"null",
")",
"{",
"/* 24-Nov-200... | DTD declarations that must be exposed | [
"DTD",
"declarations",
"that",
"must",
"be",
"exposed"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sax/WstxSAXParser.java#L1181-L1202 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sax/WstxSAXParser.java | WstxSAXParser.attributeDecl | @Override
public void attributeDecl(String eName, String aName, String type, String mode, String value)
{
if (mDeclHandler != null) {
try {
mDeclHandler.attributeDecl(eName, aName, type, mode, value);
} catch (SAXException sex) {
throw new WrappedS... | java | @Override
public void attributeDecl(String eName, String aName, String type, String mode, String value)
{
if (mDeclHandler != null) {
try {
mDeclHandler.attributeDecl(eName, aName, type, mode, value);
} catch (SAXException sex) {
throw new WrappedS... | [
"@",
"Override",
"public",
"void",
"attributeDecl",
"(",
"String",
"eName",
",",
"String",
"aName",
",",
"String",
"type",
",",
"String",
"mode",
",",
"String",
"value",
")",
"{",
"if",
"(",
"mDeclHandler",
"!=",
"null",
")",
"{",
"try",
"{",
"mDeclHandl... | DTD declarations that can be exposed | [
"DTD",
"declarations",
"that",
"can",
"be",
"exposed"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sax/WstxSAXParser.java#L1227-L1237 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDElement.java | DTDElement.createDefined | public static DTDElement createDefined(ReaderConfig cfg, Location loc, PrefixedName name,
StructValidator val, int allowedContent)
{
if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check
ExceptionUtil.throwInternal("trying to use... | java | public static DTDElement createDefined(ReaderConfig cfg, Location loc, PrefixedName name,
StructValidator val, int allowedContent)
{
if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check
ExceptionUtil.throwInternal("trying to use... | [
"public",
"static",
"DTDElement",
"createDefined",
"(",
"ReaderConfig",
"cfg",
",",
"Location",
"loc",
",",
"PrefixedName",
"name",
",",
"StructValidator",
"val",
",",
"int",
"allowedContent",
")",
"{",
"if",
"(",
"allowedContent",
"==",
"XMLValidator",
".",
"CO... | Method called to create an actual element definition, matching
an ELEMENT directive in a DTD subset. | [
"Method",
"called",
"to",
"create",
"an",
"actual",
"element",
"definition",
"matching",
"an",
"ELEMENT",
"directive",
"in",
"a",
"DTD",
"subset",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L158-L166 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDElement.java | DTDElement.createPlaceholder | public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name)
{
return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED,
cfg.willSupportNamespaces(), cfg.isXml11());
} | java | public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name)
{
return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED,
cfg.willSupportNamespaces(), cfg.isXml11());
} | [
"public",
"static",
"DTDElement",
"createPlaceholder",
"(",
"ReaderConfig",
"cfg",
",",
"Location",
"loc",
",",
"PrefixedName",
"name",
")",
"{",
"return",
"new",
"DTDElement",
"(",
"loc",
",",
"name",
",",
"null",
",",
"XMLValidator",
".",
"CONTENT_ALLOW_UNDEFI... | Method called to create a "placeholder" element definition, needed to
contain attribute definitions. | [
"Method",
"called",
"to",
"create",
"a",
"placeholder",
"element",
"definition",
"needed",
"to",
"contain",
"attribute",
"definitions",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L172-L176 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDElement.java | DTDElement.defineFrom | public void defineFrom(InputProblemReporter rep, DTDElement definedElem,
boolean fullyValidate)
throws XMLStreamException
{
if (fullyValidate) {
verifyUndefined();
}
mValidator = definedElem.mValidator;
mAllowedContent = definedElem.mAll... | java | public void defineFrom(InputProblemReporter rep, DTDElement definedElem,
boolean fullyValidate)
throws XMLStreamException
{
if (fullyValidate) {
verifyUndefined();
}
mValidator = definedElem.mValidator;
mAllowedContent = definedElem.mAll... | [
"public",
"void",
"defineFrom",
"(",
"InputProblemReporter",
"rep",
",",
"DTDElement",
"definedElem",
",",
"boolean",
"fullyValidate",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"fullyValidate",
")",
"{",
"verifyUndefined",
"(",
")",
";",
"}",
"mValidato... | Method called to "upgrade" a placeholder using a defined element,
including adding attributes. | [
"Method",
"called",
"to",
"upgrade",
"a",
"placeholder",
"using",
"a",
"defined",
"element",
"including",
"adding",
"attributes",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L211-L221 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDElement.java | DTDElement.addAttribute | public DTDAttribute addAttribute(InputProblemReporter rep,
PrefixedName attrName, int valueType,
DefaultAttrValue defValue, WordResolver enumValues,
boolean fullyValidate)
throws XMLStreamException
... | java | public DTDAttribute addAttribute(InputProblemReporter rep,
PrefixedName attrName, int valueType,
DefaultAttrValue defValue, WordResolver enumValues,
boolean fullyValidate)
throws XMLStreamException
... | [
"public",
"DTDAttribute",
"addAttribute",
"(",
"InputProblemReporter",
"rep",
",",
"PrefixedName",
"attrName",
",",
"int",
"valueType",
",",
"DefaultAttrValue",
"defValue",
",",
"WordResolver",
"enumValues",
",",
"boolean",
"fullyValidate",
")",
"throws",
"XMLStreamExce... | Method called by DTD parser when it has read information about
an attribute that belong to this element
@return Newly created attribute Object if the attribute definition was
added (hadn't been declared yet); null if it's a duplicate, in which
case original definition sticks. | [
"Method",
"called",
"by",
"DTD",
"parser",
"when",
"it",
"has",
"read",
"information",
"about",
"an",
"attribute",
"that",
"belong",
"to",
"this",
"element"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L238-L308 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDElement.java | DTDElement.addNsDefault | public DTDAttribute addNsDefault
(InputProblemReporter rep, PrefixedName attrName, int valueType,
DefaultAttrValue defValue, boolean fullyValidate)
throws XMLStreamException
{
/* Let's simplify handling a bit: although theoretically all
* combinations of value can be used, ... | java | public DTDAttribute addNsDefault
(InputProblemReporter rep, PrefixedName attrName, int valueType,
DefaultAttrValue defValue, boolean fullyValidate)
throws XMLStreamException
{
/* Let's simplify handling a bit: although theoretically all
* combinations of value can be used, ... | [
"public",
"DTDAttribute",
"addNsDefault",
"(",
"InputProblemReporter",
"rep",
",",
"PrefixedName",
"attrName",
",",
"int",
"valueType",
",",
"DefaultAttrValue",
"defValue",
",",
"boolean",
"fullyValidate",
")",
"throws",
"XMLStreamException",
"{",
"/* Let's simplify handl... | Method called to add a definition of a namespace-declaration
pseudo-attribute with a default value.
@param rep Reporter to use to report non-fatal problems
@param fullyValidate Whether this is being invoked for actual DTD validation,
or just the "typing non-validator"
@return Attribute that acts as the placeholder, i... | [
"Method",
"called",
"to",
"add",
"a",
"definition",
"of",
"a",
"namespace",
"-",
"declaration",
"pseudo",
"-",
"attribute",
"with",
"a",
"default",
"value",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L322-L359 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java | WstxOutputFactory.createSW | @SuppressWarnings("resource")
private XMLStreamWriter2 createSW(OutputStream out, Writer w, String enc,
boolean requireAutoClose)
throws XMLStreamException
{
/* Need to ensure that the configuration object is not shared
* any more; otherwise later c... | java | @SuppressWarnings("resource")
private XMLStreamWriter2 createSW(OutputStream out, Writer w, String enc,
boolean requireAutoClose)
throws XMLStreamException
{
/* Need to ensure that the configuration object is not shared
* any more; otherwise later c... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"private",
"XMLStreamWriter2",
"createSW",
"(",
"OutputStream",
"out",
",",
"Writer",
"w",
",",
"String",
"enc",
",",
"boolean",
"requireAutoClose",
")",
"throws",
"XMLStreamException",
"{",
"/* Need to ensure that th... | Bottleneck factory method used internally; needs to take care of passing
proper settings to stream writer.
@param requireAutoClose Whether this result will always require
auto-close be enabled (true); or only if application has
requested it (false) | [
"Bottleneck",
"factory",
"method",
"used",
"internally",
";",
"needs",
"to",
"take",
"care",
"of",
"passing",
"proper",
"settings",
"to",
"stream",
"writer",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java#L247-L303 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/OutputElementBase.java | OutputElementBase.isPrefixValid | public final int isPrefixValid(String prefix, String nsURI,
boolean isElement)
throws XMLStreamException
{
// Hmmm.... caller shouldn't really pass null.
if (nsURI == null) {
nsURI = "";
}
/* First thing is to see if specified p... | java | public final int isPrefixValid(String prefix, String nsURI,
boolean isElement)
throws XMLStreamException
{
// Hmmm.... caller shouldn't really pass null.
if (nsURI == null) {
nsURI = "";
}
/* First thing is to see if specified p... | [
"public",
"final",
"int",
"isPrefixValid",
"(",
"String",
"prefix",
",",
"String",
"nsURI",
",",
"boolean",
"isElement",
")",
"throws",
"XMLStreamException",
"{",
"// Hmmm.... caller shouldn't really pass null.",
"if",
"(",
"nsURI",
"==",
"null",
")",
"{",
"nsURI",
... | Method that verifies that passed-in prefix indeed maps to the specified
namespace URI; and depending on how it goes returns a status for
caller.
@param isElement If true, rules for the default NS are those of elements
(ie. empty prefix can map to non-default namespace); if false,
rules are those of attributes (only no... | [
"Method",
"that",
"verifies",
"that",
"passed",
"-",
"in",
"prefix",
"indeed",
"maps",
"to",
"the",
"specified",
"namespace",
"URI",
";",
"and",
"depending",
"on",
"how",
"it",
"goes",
"returns",
"a",
"status",
"for",
"caller",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/OutputElementBase.java#L182-L247 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java | BaseNsStreamWriter.writeAttribute | @Override
public void writeAttribute(String localName, String value)
throws XMLStreamException
{
// No need to set mAnyOutput, nor close the element
if (!mStartElementOpen && mCheckStructure) {
reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM);
}
doWriteAttr(l... | java | @Override
public void writeAttribute(String localName, String value)
throws XMLStreamException
{
// No need to set mAnyOutput, nor close the element
if (!mStartElementOpen && mCheckStructure) {
reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM);
}
doWriteAttr(l... | [
"@",
"Override",
"public",
"void",
"writeAttribute",
"(",
"String",
"localName",
",",
"String",
"value",
")",
"throws",
"XMLStreamException",
"{",
"// No need to set mAnyOutput, nor close the element",
"if",
"(",
"!",
"mStartElementOpen",
"&&",
"mCheckStructure",
")",
"... | It's assumed calling this method implies caller just wants to add
an attribute that does not belong to any namespace; as such no
namespace checking or prefix generation is needed. | [
"It",
"s",
"assumed",
"calling",
"this",
"method",
"implies",
"caller",
"just",
"wants",
"to",
"add",
"an",
"attribute",
"that",
"does",
"not",
"belong",
"to",
"any",
"namespace",
";",
"as",
"such",
"no",
"namespace",
"checking",
"or",
"prefix",
"generation"... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java#L219-L228 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java | EncodingXmlWriter.writeTypedElement | @Override
public final void writeTypedElement(AsciiValueEncoder enc)
throws IOException
{
if (mSurrogate != 0) {
throwUnpairedSurrogate();
}
if (enc.bufferNeedsFlush(mOutputBuffer.length - mOutputPtr)) {
flush();
}
while (true) {
... | java | @Override
public final void writeTypedElement(AsciiValueEncoder enc)
throws IOException
{
if (mSurrogate != 0) {
throwUnpairedSurrogate();
}
if (enc.bufferNeedsFlush(mOutputBuffer.length - mOutputPtr)) {
flush();
}
while (true) {
... | [
"@",
"Override",
"public",
"final",
"void",
"writeTypedElement",
"(",
"AsciiValueEncoder",
"enc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mSurrogate",
"!=",
"0",
")",
"{",
"throwUnpairedSurrogate",
"(",
")",
";",
"}",
"if",
"(",
"enc",
".",
"bufferNee... | Non-validating version of typed write method | [
"Non",
"-",
"validating",
"version",
"of",
"typed",
"write",
"method"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java#L578-L596 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java | EncodingXmlWriter.writeTypedElement | @Override
public final void writeTypedElement(AsciiValueEncoder enc,
XMLValidator validator, char[] copyBuffer)
throws IOException, XMLStreamException
{
if (mSurrogate != 0) {
throwUnpairedSurrogate();
}
/* Ok, this gets trickier: can't use efficient dire... | java | @Override
public final void writeTypedElement(AsciiValueEncoder enc,
XMLValidator validator, char[] copyBuffer)
throws IOException, XMLStreamException
{
if (mSurrogate != 0) {
throwUnpairedSurrogate();
}
/* Ok, this gets trickier: can't use efficient dire... | [
"@",
"Override",
"public",
"final",
"void",
"writeTypedElement",
"(",
"AsciiValueEncoder",
"enc",
",",
"XMLValidator",
"validator",
",",
"char",
"[",
"]",
"copyBuffer",
")",
"throws",
"IOException",
",",
"XMLStreamException",
"{",
"if",
"(",
"mSurrogate",
"!=",
... | Validating version of typed write method | [
"Validating",
"version",
"of",
"typed",
"write",
"method"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java#L601-L624 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java | EncodingXmlWriter.writeAsEntity | protected final int writeAsEntity(int c)
throws IOException
{
byte[] buf = mOutputBuffer;
int ptr = mOutputPtr;
if ((ptr + 10) >= buf.length) { // &#x [up to 6 hex digits] ;
flushBuffer();
ptr = mOutputPtr;
}
buf[ptr++] = BYTE_AMP;
// ... | java | protected final int writeAsEntity(int c)
throws IOException
{
byte[] buf = mOutputBuffer;
int ptr = mOutputPtr;
if ((ptr + 10) >= buf.length) { // &#x [up to 6 hex digits] ;
flushBuffer();
ptr = mOutputPtr;
}
buf[ptr++] = BYTE_AMP;
// ... | [
"protected",
"final",
"int",
"writeAsEntity",
"(",
"int",
"c",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buf",
"=",
"mOutputBuffer",
";",
"int",
"ptr",
"=",
"mOutputPtr",
";",
"if",
"(",
"(",
"ptr",
"+",
"10",
")",
">=",
"buf",
".",
"leng... | Entity writing can be optimized quite nicely, since it only
needs to output ascii characters.
@return New value of <code>mOutputPtr</code> | [
"Entity",
"writing",
"can",
"be",
"optimized",
"quite",
"nicely",
"since",
"it",
"only",
"needs",
"to",
"output",
"ascii",
"characters",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java#L828-L896 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/DataUtil.java | DataUtil.anyValuesInCommon | public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2)
{
// Let's always iterate over smaller collection:
if (c1.size() > c2.size()) {
Collection<T> tmp = c1;
c1 = c2;
c2 = tmp;
}
Iterator<T> it = c1.iterator();
whi... | java | public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2)
{
// Let's always iterate over smaller collection:
if (c1.size() > c2.size()) {
Collection<T> tmp = c1;
c1 = c2;
c2 = tmp;
}
Iterator<T> it = c1.iterator();
whi... | [
"public",
"static",
"<",
"T",
">",
"boolean",
"anyValuesInCommon",
"(",
"Collection",
"<",
"T",
">",
"c1",
",",
"Collection",
"<",
"T",
">",
"c2",
")",
"{",
"// Let's always iterate over smaller collection:",
"if",
"(",
"c1",
".",
"size",
"(",
")",
">",
"c... | Method that can be used to efficiently check if 2 collections
share at least one common element.
@return True if there is at least one element that's common
to both Collections, ie. that is contained in both of them. | [
"Method",
"that",
"can",
"be",
"used",
"to",
"efficiently",
"check",
"if",
"2",
"collections",
"share",
"at",
"least",
"one",
"common",
"element",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/DataUtil.java#L83-L98 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/StreamScanner.java | StreamScanner.throwLazyError | protected void throwLazyError(Exception e)
{
if (e instanceof XMLStreamException) {
WstxLazyException.throwLazily((XMLStreamException) e);
}
ExceptionUtil.throwRuntimeException(e);
} | java | protected void throwLazyError(Exception e)
{
if (e instanceof XMLStreamException) {
WstxLazyException.throwLazily((XMLStreamException) e);
}
ExceptionUtil.throwRuntimeException(e);
} | [
"protected",
"void",
"throwLazyError",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"XMLStreamException",
")",
"{",
"WstxLazyException",
".",
"throwLazily",
"(",
"(",
"XMLStreamException",
")",
"e",
")",
";",
"}",
"ExceptionUtil",
".",
"throw... | Method called to report an error, when caller's signature only
allows runtime exceptions to be thrown. | [
"Method",
"called",
"to",
"report",
"an",
"error",
"when",
"caller",
"s",
"signature",
"only",
"allows",
"runtime",
"exceptions",
"to",
"be",
"thrown",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L734-L740 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/StreamScanner.java | StreamScanner.loadMore | protected boolean loadMore()
throws XMLStreamException
{
WstxInputSource input = mInput;
do {
/* Need to make sure offsets are properly updated for error
* reporting purposes, and do this now while previous amounts
* are still known.
*/
... | java | protected boolean loadMore()
throws XMLStreamException
{
WstxInputSource input = mInput;
do {
/* Need to make sure offsets are properly updated for error
* reporting purposes, and do this now while previous amounts
* are still known.
*/
... | [
"protected",
"boolean",
"loadMore",
"(",
")",
"throws",
"XMLStreamException",
"{",
"WstxInputSource",
"input",
"=",
"mInput",
";",
"do",
"{",
"/* Need to make sure offsets are properly updated for error\n * reporting purposes, and do this now while previous amounts\n ... | Method that will try to read one or more characters from currently
open input sources; closing input sources if necessary.
@return true if reading succeeded (or may succeed), false if
we reached EOF. | [
"Method",
"that",
"will",
"try",
"to",
"read",
"one",
"or",
"more",
"characters",
"from",
"currently",
"open",
"input",
"sources",
";",
"closing",
"input",
"sources",
"if",
"necessary",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L997-L1051 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/StreamScanner.java | StreamScanner.validateChar | private final void validateChar(int value)
throws XMLStreamException
{
/* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic,
* need to be reported by a surrogate pair..
*/
if (value >= 0xD800) {
if (value < 0xE000) { // no surrogates via entity expans... | java | private final void validateChar(int value)
throws XMLStreamException
{
/* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic,
* need to be reported by a surrogate pair..
*/
if (value >= 0xD800) {
if (value < 0xE000) { // no surrogates via entity expans... | [
"private",
"final",
"void",
"validateChar",
"(",
"int",
"value",
")",
"throws",
"XMLStreamException",
"{",
"/* 24-Jan-2006, TSa: Ok, \"high\" Unicode chars are problematic,\n * need to be reported by a surrogate pair..\n */",
"if",
"(",
"value",
">=",
"0xD800",
")... | Method that will verify that expanded Unicode codepoint is a valid
XML content character. | [
"Method",
"that",
"will",
"verify",
"that",
"expanded",
"Unicode",
"codepoint",
"is",
"a",
"valid",
"XML",
"content",
"character",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L2390-L2419 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dom/DOMOutputElement.java | DOMOutputElement.createAndAttachChild | protected DOMOutputElement createAndAttachChild(Element element)
{
if (mRootNode != null) {
mRootNode.appendChild(element);
} else {
mElement.appendChild(element);
}
return createChild(element);
} | java | protected DOMOutputElement createAndAttachChild(Element element)
{
if (mRootNode != null) {
mRootNode.appendChild(element);
} else {
mElement.appendChild(element);
}
return createChild(element);
} | [
"protected",
"DOMOutputElement",
"createAndAttachChild",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"mRootNode",
"!=",
"null",
")",
"{",
"mRootNode",
".",
"appendChild",
"(",
"element",
")",
";",
"}",
"else",
"{",
"mElement",
".",
"appendChild",
"(",
"e... | Simplest factory method, which gets called when a 1-argument
element output method is called. It is, then, assumed to
use the default namespace.
Will both create the child element and attach it to parent element,
or lacking own owner document. | [
"Simplest",
"factory",
"method",
"which",
"gets",
"called",
"when",
"a",
"1",
"-",
"argument",
"element",
"output",
"method",
"is",
"called",
".",
"It",
"is",
"then",
"assumed",
"to",
"use",
"the",
"default",
"namespace",
".",
"Will",
"both",
"create",
"th... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dom/DOMOutputElement.java#L98-L106 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.decode | public void decode(TypedValueDecoder tvd)
throws IllegalArgumentException
{
char[] buf;
int start, end;
if (mInputStart >= 0) { // shared buffer, common case
buf = mInputBuffer;
start = mInputStart;
end = start + mInputLen;
} else {
... | java | public void decode(TypedValueDecoder tvd)
throws IllegalArgumentException
{
char[] buf;
int start, end;
if (mInputStart >= 0) { // shared buffer, common case
buf = mInputBuffer;
start = mInputStart;
end = start + mInputLen;
} else {
... | [
"public",
"void",
"decode",
"(",
"TypedValueDecoder",
"tvd",
")",
"throws",
"IllegalArgumentException",
"{",
"char",
"[",
"]",
"buf",
";",
"int",
"start",
",",
"end",
";",
"if",
"(",
"mInputStart",
">=",
"0",
")",
"{",
"// shared buffer, common case",
"buf",
... | Generic pass-through method which call given decoder
with accumulated data | [
"Generic",
"pass",
"-",
"through",
"method",
"which",
"call",
"given",
"decoder",
"with",
"accumulated",
"data"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L412-L442 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.decodeElements | public int decodeElements(TypedArrayDecoder tad, InputProblemReporter rep)
throws TypedXMLStreamException
{
int count = 0;
/* First: for simplicity, we require a single flat buffer to
* decode from. Second: to be able to update start location
* (to keep track of what's ava... | java | public int decodeElements(TypedArrayDecoder tad, InputProblemReporter rep)
throws TypedXMLStreamException
{
int count = 0;
/* First: for simplicity, we require a single flat buffer to
* decode from. Second: to be able to update start location
* (to keep track of what's ava... | [
"public",
"int",
"decodeElements",
"(",
"TypedArrayDecoder",
"tad",
",",
"InputProblemReporter",
"rep",
")",
"throws",
"TypedXMLStreamException",
"{",
"int",
"count",
"=",
"0",
";",
"/* First: for simplicity, we require a single flat buffer to\n * decode from. Second: to ... | Pass-through decode method called to find find the next token,
decode it, and repeat the process as long as there are more
tokens and the array decoder accepts more entries.
All tokens processed will be "consumed", such that they will
not be visible via buffer.
@return Number of tokens decoded; 0 means that no (more) ... | [
"Pass",
"-",
"through",
"decode",
"method",
"called",
"to",
"find",
"find",
"the",
"next",
"token",
"decode",
"it",
"and",
"repeat",
"the",
"process",
"as",
"long",
"as",
"there",
"are",
"more",
"tokens",
"and",
"the",
"array",
"decoder",
"accepts",
"more"... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L454-L523 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.initBinaryChunks | public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk)
{
if (mInputStart < 0) { // non-shared
dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments);
} else { // shared
dec.init(v, firstChunk, mInputBuffer, mInputStart, mIn... | java | public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk)
{
if (mInputStart < 0) { // non-shared
dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments);
} else { // shared
dec.init(v, firstChunk, mInputBuffer, mInputStart, mIn... | [
"public",
"void",
"initBinaryChunks",
"(",
"Base64Variant",
"v",
",",
"CharArrayBase64Decoder",
"dec",
",",
"boolean",
"firstChunk",
")",
"{",
"if",
"(",
"mInputStart",
"<",
"0",
")",
"{",
"// non-shared",
"dec",
".",
"init",
"(",
"v",
",",
"firstChunk",
","... | Method that needs to be called to configure given base64 decoder
with textual contents collected by this buffer.
@param dec Decoder that will need data
@param firstChunk Whether this is the first segment fed or not;
if it is, state needs to be fullt reset; if not, only partially. | [
"Method",
"that",
"needs",
"to",
"be",
"called",
"to",
"configure",
"given",
"base64",
"decoder",
"with",
"textual",
"contents",
"collected",
"by",
"this",
"buffer",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L533-L540 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.rawContentsTo | public int rawContentsTo(Writer w)
throws IOException
{
// Let's first see if we have created helper objects:
if (mResultArray != null) {
w.write(mResultArray);
return mResultArray.length;
}
if (mResultString != null) {
w.write(mResultStrin... | java | public int rawContentsTo(Writer w)
throws IOException
{
// Let's first see if we have created helper objects:
if (mResultArray != null) {
w.write(mResultArray);
return mResultArray.length;
}
if (mResultString != null) {
w.write(mResultStrin... | [
"public",
"int",
"rawContentsTo",
"(",
"Writer",
"w",
")",
"throws",
"IOException",
"{",
"// Let's first see if we have created helper objects:",
"if",
"(",
"mResultArray",
"!=",
"null",
")",
"{",
"w",
".",
"write",
"(",
"mResultArray",
")",
";",
"return",
"mResul... | Method that will stream contents of this buffer into specified
Writer. | [
"Method",
"that",
"will",
"stream",
"contents",
"of",
"this",
"buffer",
"into",
"specified",
"Writer",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L723-L757 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.endsWith | public boolean endsWith(String str)
{
/* Let's just play this safe; should seldom if ever happen...
* and because of that, can be sub-optimal, performancewise, to
* alternatives.
*/
if (mInputStart >= 0) {
unshare(16);
}
int segIndex = (mSegmen... | java | public boolean endsWith(String str)
{
/* Let's just play this safe; should seldom if ever happen...
* and because of that, can be sub-optimal, performancewise, to
* alternatives.
*/
if (mInputStart >= 0) {
unshare(16);
}
int segIndex = (mSegmen... | [
"public",
"boolean",
"endsWith",
"(",
"String",
"str",
")",
"{",
"/* Let's just play this safe; should seldom if ever happen...\n * and because of that, can be sub-optimal, performancewise, to\n * alternatives.\n */",
"if",
"(",
"mInputStart",
">=",
"0",
")",
"{... | Method that can be used to check if the contents of the buffer end
in specified String.
@return True if the textual content buffer contains ends with the
specified String; false otherwise | [
"Method",
"that",
"can",
"be",
"used",
"to",
"check",
"if",
"the",
"contents",
"of",
"the",
"buffer",
"end",
"in",
"specified",
"String",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L827-L859 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.calcNewSize | private int calcNewSize(int latestSize)
{
// Let's grow segments by 50%, when over 8k
int incr = (latestSize < 8000) ? latestSize : (latestSize >> 1);
int size = latestSize + incr;
// but let's not create too big chunks
return Math.min(size, MAX_SEGMENT_LENGTH);
} | java | private int calcNewSize(int latestSize)
{
// Let's grow segments by 50%, when over 8k
int incr = (latestSize < 8000) ? latestSize : (latestSize >> 1);
int size = latestSize + incr;
// but let's not create too big chunks
return Math.min(size, MAX_SEGMENT_LENGTH);
} | [
"private",
"int",
"calcNewSize",
"(",
"int",
"latestSize",
")",
"{",
"// Let's grow segments by 50%, when over 8k",
"int",
"incr",
"=",
"(",
"latestSize",
"<",
"8000",
")",
"?",
"latestSize",
":",
"(",
"latestSize",
">>",
"1",
")",
";",
"int",
"size",
"=",
"... | Method used to determine size of the next segment to
allocate to contain textual content. | [
"Method",
"used",
"to",
"determine",
"size",
"of",
"the",
"next",
"segment",
"to",
"allocate",
"to",
"contain",
"textual",
"content",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L1155-L1162 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/TextBuffer.java | TextBuffer.expand | private void expand(int roomNeeded)
{
// First, let's move current segment to segment list:
if (mSegments == null) {
mSegments = new ArrayList<char[]>();
}
char[] curr = mCurrentSegment;
mHasSegments = true;
mSegments.add(curr);
int oldLen = curr.l... | java | private void expand(int roomNeeded)
{
// First, let's move current segment to segment list:
if (mSegments == null) {
mSegments = new ArrayList<char[]>();
}
char[] curr = mCurrentSegment;
mHasSegments = true;
mSegments.add(curr);
int oldLen = curr.l... | [
"private",
"void",
"expand",
"(",
"int",
"roomNeeded",
")",
"{",
"// First, let's move current segment to segment list:",
"if",
"(",
"mSegments",
"==",
"null",
")",
"{",
"mSegments",
"=",
"new",
"ArrayList",
"<",
"char",
"[",
"]",
">",
"(",
")",
";",
"}",
"c... | Method called when current segment is full, to allocate new
segment.
@param roomNeeded Number of characters that the resulting
new buffer must have | [
"Method",
"called",
"when",
"current",
"segment",
"is",
"full",
"to",
"allocate",
"new",
"segment",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L1218-L1233 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/BranchingReaderSource.java | BranchingReaderSource.endBranch | public void endBranch(int endOffset)
{
if (mBranchBuffer != null) {
if (endOffset > mBranchStartOffset) {
appendBranched(mBranchStartOffset, endOffset);
}
// Let's also make sure no branching is done from this point on:
mBranchBuffer = null;
... | java | public void endBranch(int endOffset)
{
if (mBranchBuffer != null) {
if (endOffset > mBranchStartOffset) {
appendBranched(mBranchStartOffset, endOffset);
}
// Let's also make sure no branching is done from this point on:
mBranchBuffer = null;
... | [
"public",
"void",
"endBranch",
"(",
"int",
"endOffset",
")",
"{",
"if",
"(",
"mBranchBuffer",
"!=",
"null",
")",
"{",
"if",
"(",
"endOffset",
">",
"mBranchStartOffset",
")",
"{",
"appendBranched",
"(",
"mBranchStartOffset",
",",
"endOffset",
")",
";",
"}",
... | Currently this input source does not implement branching | [
"Currently",
"this",
"input",
"source",
"does",
"not",
"implement",
"branching"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/BranchingReaderSource.java#L97-L106 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/XmlWriter.java | XmlWriter.verifyNameValidity | public final void verifyNameValidity(String name, boolean checkNs)
throws XMLStreamException
{
/* No empty names... caller must have dealt with optional arguments
* prior to calling this method
*/
if (name == null || name.length() == 0) {
reportNwfName(ErrorCons... | java | public final void verifyNameValidity(String name, boolean checkNs)
throws XMLStreamException
{
/* No empty names... caller must have dealt with optional arguments
* prior to calling this method
*/
if (name == null || name.length() == 0) {
reportNwfName(ErrorCons... | [
"public",
"final",
"void",
"verifyNameValidity",
"(",
"String",
"name",
",",
"boolean",
"checkNs",
")",
"throws",
"XMLStreamException",
"{",
"/* No empty names... caller must have dealt with optional arguments\n * prior to calling this method\n */",
"if",
"(",
"name... | Method called to verify that the name is a legal XML name. | [
"Method",
"called",
"to",
"verify",
"that",
"the",
"name",
"is",
"a",
"legal",
"XML",
"name",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/XmlWriter.java#L546-L564 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java | BaseStreamWriter.addDefaultAttribute | @Override
public int addDefaultAttribute(String localName, String uri, String prefix,
String value)
{
// nothing to do, but to indicate we didn't add it...
return -1;
} | java | @Override
public int addDefaultAttribute(String localName, String uri, String prefix,
String value)
{
// nothing to do, but to indicate we didn't add it...
return -1;
} | [
"@",
"Override",
"public",
"int",
"addDefaultAttribute",
"(",
"String",
"localName",
",",
"String",
"uri",
",",
"String",
"prefix",
",",
"String",
"value",
")",
"{",
"// nothing to do, but to indicate we didn't add it...",
"return",
"-",
"1",
";",
"}"
] | Adding default attribute values does not usually make sense on
output side, so the implementation is a NOP for now. | [
"Adding",
"default",
"attribute",
"values",
"does",
"not",
"usually",
"make",
"sense",
"on",
"output",
"side",
"so",
"the",
"implementation",
"is",
"a",
"NOP",
"for",
"now",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java#L1257-L1263 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/BasicStreamReader.java | BasicStreamReader.handleStartElem | private final void handleStartElem(char c)
throws XMLStreamException
{
mTokenState = TOKEN_FULL_COALESCED;
boolean empty;
if (mCfgNsEnabled) {
String str = parseLocalName(c);
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCha... | java | private final void handleStartElem(char c)
throws XMLStreamException
{
mTokenState = TOKEN_FULL_COALESCED;
boolean empty;
if (mCfgNsEnabled) {
String str = parseLocalName(c);
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCha... | [
"private",
"final",
"void",
"handleStartElem",
"(",
"char",
"c",
")",
"throws",
"XMLStreamException",
"{",
"mTokenState",
"=",
"TOKEN_FULL_COALESCED",
";",
"boolean",
"empty",
";",
"if",
"(",
"mCfgNsEnabled",
")",
"{",
"String",
"str",
"=",
"parseLocalName",
"("... | Method that takes care of parsing of start elements; including
full parsing of namespace declarations and attributes, as well as
namespace resolution. | [
"Method",
"that",
"takes",
"care",
"of",
"parsing",
"of",
"start",
"elements",
";",
"including",
"full",
"parsing",
"of",
"namespace",
"declarations",
"and",
"attributes",
"as",
"well",
"as",
"namespace",
"resolution",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/BasicStreamReader.java#L3004-L3052 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/BasicStreamReader.java | BasicStreamReader.readPI | private void readPI()
throws XMLStreamException
{
int ptr = mInputPtr;
int start = ptr;
char[] inputBuf = mInputBuffer;
int inputLen = mInputEnd;
outer_loop:
while (ptr < inputLen) {
char c = inputBuf[ptr++];
if (c < CHAR_SPACE) {
... | java | private void readPI()
throws XMLStreamException
{
int ptr = mInputPtr;
int start = ptr;
char[] inputBuf = mInputBuffer;
int inputLen = mInputEnd;
outer_loop:
while (ptr < inputLen) {
char c = inputBuf[ptr++];
if (c < CHAR_SPACE) {
... | [
"private",
"void",
"readPI",
"(",
")",
"throws",
"XMLStreamException",
"{",
"int",
"ptr",
"=",
"mInputPtr",
";",
"int",
"start",
"=",
"ptr",
";",
"char",
"[",
"]",
"inputBuf",
"=",
"mInputBuffer",
";",
"int",
"inputLen",
"=",
"mInputEnd",
";",
"outer_loop"... | Method that parses a processing instruction's data portion; at this
point target has been parsed. | [
"Method",
"that",
"parses",
"a",
"processing",
"instruction",
"s",
"data",
"portion",
";",
"at",
"this",
"point",
"target",
"has",
"been",
"parsed",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/BasicStreamReader.java#L4042-L4100 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/BasicStreamReader.java | BasicStreamReader.readSpacePrimary | private final boolean readSpacePrimary(char c, boolean prologWS)
throws XMLStreamException
{
int ptr = mInputPtr;
char[] inputBuf = mInputBuffer;
int inputLen = mInputEnd;
int start = ptr-1;
// Let's first see if we can just share input buffer:
while (true) {... | java | private final boolean readSpacePrimary(char c, boolean prologWS)
throws XMLStreamException
{
int ptr = mInputPtr;
char[] inputBuf = mInputBuffer;
int inputLen = mInputEnd;
int start = ptr-1;
// Let's first see if we can just share input buffer:
while (true) {... | [
"private",
"final",
"boolean",
"readSpacePrimary",
"(",
"char",
"c",
",",
"boolean",
"prologWS",
")",
"throws",
"XMLStreamException",
"{",
"int",
"ptr",
"=",
"mInputPtr",
";",
"char",
"[",
"]",
"inputBuf",
"=",
"mInputBuffer",
";",
"int",
"inputLen",
"=",
"m... | Reading whitespace should be very similar to reading normal text;
although couple of simplifications can be made. Further, since this
method is very unlikely to be of much performance concern, some
optimizations are left out, where it simplifies code.
@param c First white space characters; known to contain white space... | [
"Reading",
"whitespace",
"should",
"be",
"very",
"similar",
"to",
"reading",
"normal",
"text",
";",
"although",
"couple",
"of",
"simplifications",
"can",
"be",
"made",
".",
"Further",
"since",
"this",
"method",
"is",
"very",
"unlikely",
"to",
"be",
"of",
"mu... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/BasicStreamReader.java#L4987-L5046 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/BasicStreamReader.java | BasicStreamReader._constructUnexpectedInTyped | protected XMLStreamException _constructUnexpectedInTyped(int nextToken) {
if (nextToken == START_ELEMENT) {
return _constructTypeException("Element content can not contain child START_ELEMENT when using Typed Access methods", null);
}
return _constructTypeException("Expected a text t... | java | protected XMLStreamException _constructUnexpectedInTyped(int nextToken) {
if (nextToken == START_ELEMENT) {
return _constructTypeException("Element content can not contain child START_ELEMENT when using Typed Access methods", null);
}
return _constructTypeException("Expected a text t... | [
"protected",
"XMLStreamException",
"_constructUnexpectedInTyped",
"(",
"int",
"nextToken",
")",
"{",
"if",
"(",
"nextToken",
"==",
"START_ELEMENT",
")",
"{",
"return",
"_constructTypeException",
"(",
"\"Element content can not contain child START_ELEMENT when using Typed Access m... | Method called to report a problem with | [
"Method",
"called",
"to",
"report",
"a",
"problem",
"with"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/BasicStreamReader.java#L5601-L5606 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.readInternalSubset | public static DTDSubset readInternalSubset(WstxInputData srcData,
WstxInputSource input,
ReaderConfig cfg,
boolean constructFully,
i... | java | public static DTDSubset readInternalSubset(WstxInputData srcData,
WstxInputSource input,
ReaderConfig cfg,
boolean constructFully,
i... | [
"public",
"static",
"DTDSubset",
"readInternalSubset",
"(",
"WstxInputData",
"srcData",
",",
"WstxInputSource",
"input",
",",
"ReaderConfig",
"cfg",
",",
"boolean",
"constructFully",
",",
"int",
"xmlVersion",
")",
"throws",
"XMLStreamException",
"{",
"FullDTDReader",
... | Method called to read in the internal subset definition. | [
"Method",
"called",
"to",
"read",
"in",
"the",
"internal",
"subset",
"definition",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L414-L436 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.readExternalSubset | public static DTDSubset readExternalSubset
(WstxInputSource src, ReaderConfig cfg, DTDSubset intSubset,
boolean constructFully, int xmlVersion)
throws XMLStreamException
{
FullDTDReader r = new FullDTDReader(src, cfg, intSubset, constructFully, xmlVersion);
return r.parseDT... | java | public static DTDSubset readExternalSubset
(WstxInputSource src, ReaderConfig cfg, DTDSubset intSubset,
boolean constructFully, int xmlVersion)
throws XMLStreamException
{
FullDTDReader r = new FullDTDReader(src, cfg, intSubset, constructFully, xmlVersion);
return r.parseDT... | [
"public",
"static",
"DTDSubset",
"readExternalSubset",
"(",
"WstxInputSource",
"src",
",",
"ReaderConfig",
"cfg",
",",
"DTDSubset",
"intSubset",
",",
"boolean",
"constructFully",
",",
"int",
"xmlVersion",
")",
"throws",
"XMLStreamException",
"{",
"FullDTDReader",
"r",... | Method called to read in the external subset definition. | [
"Method",
"called",
"to",
"read",
"in",
"the",
"external",
"subset",
"definition",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L441-L448 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.setFlattenWriter | public void setFlattenWriter(Writer w, boolean inclComments,
boolean inclConditionals, boolean inclPEs)
{
mFlattenWriter = new DTDWriter(w, inclComments, inclConditionals,
inclPEs);
} | java | public void setFlattenWriter(Writer w, boolean inclComments,
boolean inclConditionals, boolean inclPEs)
{
mFlattenWriter = new DTDWriter(w, inclComments, inclConditionals,
inclPEs);
} | [
"public",
"void",
"setFlattenWriter",
"(",
"Writer",
"w",
",",
"boolean",
"inclComments",
",",
"boolean",
"inclConditionals",
",",
"boolean",
"inclPEs",
")",
"{",
"mFlattenWriter",
"=",
"new",
"DTDWriter",
"(",
"w",
",",
"inclComments",
",",
"inclConditionals",
... | Method that will set specified Writer as the 'flattening writer';
writer used to output flattened version of DTD read in. This is
similar to running a C-preprocessor on C-sources, except that
defining writer will not prevent normal parsing of DTD itself. | [
"Method",
"that",
"will",
"set",
"specified",
"Writer",
"as",
"the",
"flattening",
"writer",
";",
"writer",
"used",
"to",
"output",
"flattened",
"version",
"of",
"DTD",
"read",
"in",
".",
"This",
"is",
"similar",
"to",
"running",
"a",
"C",
"-",
"preprocess... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L510-L515 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.expandPE | private void expandPE()
throws XMLStreamException
{
String id;
char c;
if (mCheckForbiddenPEs) {
/* Ok; we hit a PE where we should not have (within the internal
* dtd subset proper, within a declaration). This is a WF error.
*/
thro... | java | private void expandPE()
throws XMLStreamException
{
String id;
char c;
if (mCheckForbiddenPEs) {
/* Ok; we hit a PE where we should not have (within the internal
* dtd subset proper, within a declaration). This is a WF error.
*/
thro... | [
"private",
"void",
"expandPE",
"(",
")",
"throws",
"XMLStreamException",
"{",
"String",
"id",
";",
"char",
"c",
";",
"if",
"(",
"mCheckForbiddenPEs",
")",
"{",
"/* Ok; we hit a PE where we should not have (within the internal\n * dtd subset proper, within a declarat... | Method called to handle expansion of parameter entities. When called,
'%' character has been encountered as a reference indicator, and
now we should get parameter entity name. | [
"Method",
"called",
"to",
"handle",
"expansion",
"of",
"parameter",
"entities",
".",
"When",
"called",
"%",
"character",
"has",
"been",
"encountered",
"as",
"a",
"reference",
"indicator",
"and",
"now",
"we",
"should",
"get",
"parameter",
"entity",
"name",
"."
... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L1095-L1137 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.checkDTDKeyword | protected String checkDTDKeyword(String exp)
throws XMLStreamException
{
int i = 0;
int len = exp.length();
char c = ' ';
for (; i < len; ++i) {
if (mInputPtr < mInputEnd) {
c = mInputBuffer[mInputPtr++];
} else {
c = d... | java | protected String checkDTDKeyword(String exp)
throws XMLStreamException
{
int i = 0;
int len = exp.length();
char c = ' ';
for (; i < len; ++i) {
if (mInputPtr < mInputEnd) {
c = mInputBuffer[mInputPtr++];
} else {
c = d... | [
"protected",
"String",
"checkDTDKeyword",
"(",
"String",
"exp",
")",
"throws",
"XMLStreamException",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"len",
"=",
"exp",
".",
"length",
"(",
")",
";",
"char",
"c",
"=",
"'",
"'",
";",
"for",
"(",
";",
"i",
"<",... | Method called to verify whether input has specified keyword; if it
has, returns null and points to char after the keyword; if not,
returns whatever constitutes a keyword matched, for error
reporting purposes. | [
"Method",
"called",
"to",
"verify",
"whether",
"input",
"has",
"specified",
"keyword",
";",
"if",
"it",
"has",
"returns",
"null",
"and",
"points",
"to",
"char",
"after",
"the",
"keyword",
";",
"if",
"not",
"returns",
"whatever",
"constitutes",
"a",
"keyword"... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L1151-L1197 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.readMixedSpec | private StructValidator readMixedSpec(PrefixedName elemName, boolean construct)
throws XMLStreamException
{
String keyw = checkDTDKeyword("PCDATA");
if (keyw != null) {
_reportWFCViolation("Unrecognized directive #"+keyw+"'; expected #PCDATA (or element name)");
}
... | java | private StructValidator readMixedSpec(PrefixedName elemName, boolean construct)
throws XMLStreamException
{
String keyw = checkDTDKeyword("PCDATA");
if (keyw != null) {
_reportWFCViolation("Unrecognized directive #"+keyw+"'; expected #PCDATA (or element name)");
}
... | [
"private",
"StructValidator",
"readMixedSpec",
"(",
"PrefixedName",
"elemName",
",",
"boolean",
"construct",
")",
"throws",
"XMLStreamException",
"{",
"String",
"keyw",
"=",
"checkDTDKeyword",
"(",
"\"PCDATA\"",
")",
";",
"if",
"(",
"keyw",
"!=",
"null",
")",
"{... | Method called to parse what seems like a mixed content specification.
@param construct If true, will build full object for validating content
within mixed content model; if false, will just parse and discard
information (done in non-validating DTD-supporting mode) | [
"Method",
"called",
"to",
"parse",
"what",
"seems",
"like",
"a",
"mixed",
"content",
"specification",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L2986-L3050 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/FullDTDReader.java | FullDTDReader.handleUndeclaredEntity | @Override
protected void handleUndeclaredEntity(String id)
throws XMLStreamException
{
_reportVCViolation("Undeclared parameter entity '"+id+"'.");
if (mCurrAttrDefault != null) {
Location loc = getLastCharLocation();
if (mExpandingPE) {
mCurrAttrD... | java | @Override
protected void handleUndeclaredEntity(String id)
throws XMLStreamException
{
_reportVCViolation("Undeclared parameter entity '"+id+"'.");
if (mCurrAttrDefault != null) {
Location loc = getLastCharLocation();
if (mExpandingPE) {
mCurrAttrD... | [
"@",
"Override",
"protected",
"void",
"handleUndeclaredEntity",
"(",
"String",
"id",
")",
"throws",
"XMLStreamException",
"{",
"_reportVCViolation",
"(",
"\"Undeclared parameter entity '\"",
"+",
"id",
"+",
"\"'.\"",
")",
";",
"if",
"(",
"mCurrAttrDefault",
"!=",
"n... | Undeclared parameter entity is a VC, not WFC... | [
"Undeclared",
"parameter",
"entity",
"is",
"a",
"VC",
"not",
"WFC",
"..."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L3407-L3426 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/evt/MergedNsContext.java | MergedNsContext.outputNamespaceDeclarations | @Override
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
Namespace ns = mNamespaces.get(i);
if (ns.isDefaultNamespaceDeclaration()) {
w.writeDefaultNamespace(ns.getNa... | java | @Override
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
Namespace ns = mNamespaces.get(i);
if (ns.isDefaultNamespaceDeclaration()) {
w.writeDefaultNamespace(ns.getNa... | [
"@",
"Override",
"public",
"void",
"outputNamespaceDeclarations",
"(",
"XMLStreamWriter",
"w",
")",
"throws",
"XMLStreamException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"len",
"=",
"mNamespaces",
".",
"size",
"(",
")",
";",
"i",
"<",
"len",
";",
"... | Method called by the matching start element class to
output all namespace declarations active in current namespace
scope, if any. | [
"Method",
"called",
"by",
"the",
"matching",
"start",
"element",
"class",
"to",
"output",
"all",
"namespace",
"declarations",
"active",
"in",
"current",
"namespace",
"scope",
"if",
"any",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/evt/MergedNsContext.java#L168-L179 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/api/WriterConfig.java | WriterConfig.allocMediumCBuffer | public char[] allocMediumCBuffer(int minSize)
{
if (mCurrRecycler != null) {
char[] result = mCurrRecycler.getMediumCBuffer(minSize);
if (result != null) {
return result;
}
}
return new char[minSize];
} | java | public char[] allocMediumCBuffer(int minSize)
{
if (mCurrRecycler != null) {
char[] result = mCurrRecycler.getMediumCBuffer(minSize);
if (result != null) {
return result;
}
}
return new char[minSize];
} | [
"public",
"char",
"[",
"]",
"allocMediumCBuffer",
"(",
"int",
"minSize",
")",
"{",
"if",
"(",
"mCurrRecycler",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"result",
"=",
"mCurrRecycler",
".",
"getMediumCBuffer",
"(",
"minSize",
")",
";",
"if",
"(",
"result... | Method called to allocate intermediate recyclable copy buffers | [
"Method",
"called",
"to",
"allocate",
"intermediate",
"recyclable",
"copy",
"buffers"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/api/WriterConfig.java#L799-L808 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/InputSourceFactory.java | InputSourceFactory.constructDocumentSource | public static BranchingReaderSource constructDocumentSource
(ReaderConfig cfg, InputBootstrapper bs, String pubId, SystemId sysId,
Reader r, boolean realClose)
{
/* To resolve [WSTX-50] need to ensure that P_BASE_URL overrides
* the defaults if/as necessary
*/
URL... | java | public static BranchingReaderSource constructDocumentSource
(ReaderConfig cfg, InputBootstrapper bs, String pubId, SystemId sysId,
Reader r, boolean realClose)
{
/* To resolve [WSTX-50] need to ensure that P_BASE_URL overrides
* the defaults if/as necessary
*/
URL... | [
"public",
"static",
"BranchingReaderSource",
"constructDocumentSource",
"(",
"ReaderConfig",
"cfg",
",",
"InputBootstrapper",
"bs",
",",
"String",
"pubId",
",",
"SystemId",
"sysId",
",",
"Reader",
"r",
",",
"boolean",
"realClose",
")",
"{",
"/* To resolve [WSTX-50] ne... | Factory method used for creating the main-level document reader
source. | [
"Factory",
"method",
"used",
"for",
"creating",
"the",
"main",
"-",
"level",
"document",
"reader",
"source",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/InputSourceFactory.java#L46-L63 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/InputSourceFactory.java | InputSourceFactory.constructCharArraySource | public static WstxInputSource constructCharArraySource
(WstxInputSource parent, String fromEntity,
char[] text, int offset, int len, Location loc, URL src)
{
SystemId sysId = SystemId.construct(loc.getSystemId(), src);
return new CharArraySource(parent, fromEntity, text, offset, len, l... | java | public static WstxInputSource constructCharArraySource
(WstxInputSource parent, String fromEntity,
char[] text, int offset, int len, Location loc, URL src)
{
SystemId sysId = SystemId.construct(loc.getSystemId(), src);
return new CharArraySource(parent, fromEntity, text, offset, len, l... | [
"public",
"static",
"WstxInputSource",
"constructCharArraySource",
"(",
"WstxInputSource",
"parent",
",",
"String",
"fromEntity",
",",
"char",
"[",
"]",
"text",
",",
"int",
"offset",
",",
"int",
"len",
",",
"Location",
"loc",
",",
"URL",
"src",
")",
"{",
"Sy... | Factory method usually used to expand internal parsed entities; in
which case context remains mostly the same. | [
"Factory",
"method",
"usually",
"used",
"to",
"expand",
"internal",
"parsed",
"entities",
";",
"in",
"which",
"case",
"context",
"remains",
"mostly",
"the",
"same",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/InputSourceFactory.java#L69-L75 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java | SimpleOutputElement.createChild | protected SimpleOutputElement createChild(String localName)
{
/* At this point we can also discard attribute Map; it is assumed
* that when a child element has been opened, no more attributes
* can be output.
*/
mAttrSet = null;
return new SimpleOutputElement(this,... | java | protected SimpleOutputElement createChild(String localName)
{
/* At this point we can also discard attribute Map; it is assumed
* that when a child element has been opened, no more attributes
* can be output.
*/
mAttrSet = null;
return new SimpleOutputElement(this,... | [
"protected",
"SimpleOutputElement",
"createChild",
"(",
"String",
"localName",
")",
"{",
"/* At this point we can also discard attribute Map; it is assumed\n * that when a child element has been opened, no more attributes\n * can be output.\n */",
"mAttrSet",
"=",
"null... | Simplest factory method, which gets called when a 1-argument
element output method is called. It is, then, assumed to
use the default namespce. | [
"Simplest",
"factory",
"method",
"which",
"gets",
"called",
"when",
"a",
"1",
"-",
"argument",
"element",
"output",
"method",
"is",
"called",
".",
"It",
"is",
"then",
"assumed",
"to",
"use",
"the",
"default",
"namespce",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java#L147-L156 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java | SimpleOutputElement.createChild | protected SimpleOutputElement createChild(String prefix, String localName,
String uri)
{
/* At this point we can also discard attribute Map; it is assumed
* that when a child element has been opened, no more attributes
* can be output.
... | java | protected SimpleOutputElement createChild(String prefix, String localName,
String uri)
{
/* At this point we can also discard attribute Map; it is assumed
* that when a child element has been opened, no more attributes
* can be output.
... | [
"protected",
"SimpleOutputElement",
"createChild",
"(",
"String",
"prefix",
",",
"String",
"localName",
",",
"String",
"uri",
")",
"{",
"/* At this point we can also discard attribute Map; it is assumed\n * that when a child element has been opened, no more attributes\n *... | Full factory method, used for 'normal' namespace qualified output
methods. | [
"Full",
"factory",
"method",
"used",
"for",
"normal",
"namespace",
"qualified",
"output",
"methods",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java#L184-L193 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/api/ReaderConfig.java | ReaderConfig.configureForSpeed | public void configureForSpeed()
{
// StAX (1.0):
doCoalesceText(false);
// StAX2:
doPreserveLocation(false);
doReportPrologWhitespace(false);
//doInternNames(true); // this is a NOP
doInternNsURIs(true);
doXmlIdUniqChecks(false);
// Woodstox-... | java | public void configureForSpeed()
{
// StAX (1.0):
doCoalesceText(false);
// StAX2:
doPreserveLocation(false);
doReportPrologWhitespace(false);
//doInternNames(true); // this is a NOP
doInternNsURIs(true);
doXmlIdUniqChecks(false);
// Woodstox-... | [
"public",
"void",
"configureForSpeed",
"(",
")",
"{",
"// StAX (1.0):",
"doCoalesceText",
"(",
"false",
")",
";",
"// StAX2:",
"doPreserveLocation",
"(",
"false",
")",
";",
"doReportPrologWhitespace",
"(",
"false",
")",
";",
"//doInternNames(true); // this is a NOP",
... | Method to call to make the Reader created be as fast as possible reading
documents, especially for long-running processes where caching is
likely to help.
See {@link XMLInputFactory2#configureForSpeed} for
required settings for standard StAX/StAX properties.
<p>
In addition to the standard settings, following Woodstox... | [
"Method",
"to",
"call",
"to",
"make",
"the",
"Reader",
"created",
"be",
"as",
"fast",
"as",
"possible",
"reading",
"documents",
"especially",
"for",
"long",
"-",
"running",
"processes",
"where",
"caching",
"is",
"likely",
"to",
"help",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/api/ReaderConfig.java#L1131-L1154 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/SymbolTable.java | SymbolTable.calcHash | @SuppressWarnings("cast")
public static int calcHash(char[] buffer, int start, int len) {
int hash = (int) buffer[start];
for (int i = 1; i < len; ++i) {
hash = (hash * 31) + (int) buffer[start+i];
}
return hash;
} | java | @SuppressWarnings("cast")
public static int calcHash(char[] buffer, int start, int len) {
int hash = (int) buffer[start];
for (int i = 1; i < len; ++i) {
hash = (hash * 31) + (int) buffer[start+i];
}
return hash;
} | [
"@",
"SuppressWarnings",
"(",
"\"cast\"",
")",
"public",
"static",
"int",
"calcHash",
"(",
"char",
"[",
"]",
"buffer",
",",
"int",
"start",
",",
"int",
"len",
")",
"{",
"int",
"hash",
"=",
"(",
"int",
")",
"buffer",
"[",
"start",
"]",
";",
"for",
"... | Implementation of a hashing method for variable length
Strings. Most of the time intention is that this calculation
is done by caller during parsing, not here; however, sometimes
it needs to be done for parsed "String" too.
@param len Length of String; has to be at least 1 (caller guarantees
this pre-condition) | [
"Implementation",
"of",
"a",
"hashing",
"method",
"for",
"variable",
"length",
"Strings",
".",
"Most",
"of",
"the",
"time",
"intention",
"is",
"that",
"this",
"calculation",
"is",
"done",
"by",
"caller",
"during",
"parsing",
"not",
"here",
";",
"however",
"s... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/SymbolTable.java#L558-L565 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/SymbolTable.java | SymbolTable.copyArrays | private void copyArrays() {
String[] oldSyms = mSymbols;
int size = oldSyms.length;
mSymbols = new String[size];
System.arraycopy(oldSyms, 0, mSymbols, 0, size);
Bucket[] oldBuckets = mBuckets;
size = oldBuckets.length;
mBuckets = new Bucket[size];
System.... | java | private void copyArrays() {
String[] oldSyms = mSymbols;
int size = oldSyms.length;
mSymbols = new String[size];
System.arraycopy(oldSyms, 0, mSymbols, 0, size);
Bucket[] oldBuckets = mBuckets;
size = oldBuckets.length;
mBuckets = new Bucket[size];
System.... | [
"private",
"void",
"copyArrays",
"(",
")",
"{",
"String",
"[",
"]",
"oldSyms",
"=",
"mSymbols",
";",
"int",
"size",
"=",
"oldSyms",
".",
"length",
";",
"mSymbols",
"=",
"new",
"String",
"[",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldSyms",... | Method called when copy-on-write is needed; generally when first
change is made to a derived symbol table. | [
"Method",
"called",
"when",
"copy",
"-",
"on",
"-",
"write",
"is",
"needed",
";",
"generally",
"when",
"first",
"change",
"is",
"made",
"to",
"a",
"derived",
"symbol",
"table",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/SymbolTable.java#L587-L596 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDAttribute.java | DTDAttribute.normalizeDefault | public void normalizeDefault()
{
String val = mDefValue.getValue();
if (val.length() > 0) {
char[] cbuf = val.toCharArray();
String str = StringUtil.normalizeSpaces(cbuf, 0, cbuf.length);
if (str != null) {
mDefValue.setValue(str);
}
... | java | public void normalizeDefault()
{
String val = mDefValue.getValue();
if (val.length() > 0) {
char[] cbuf = val.toCharArray();
String str = StringUtil.normalizeSpaces(cbuf, 0, cbuf.length);
if (str != null) {
mDefValue.setValue(str);
}
... | [
"public",
"void",
"normalizeDefault",
"(",
")",
"{",
"String",
"val",
"=",
"mDefValue",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"val",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"char",
"[",
"]",
"cbuf",
"=",
"val",
".",
"toCharArray",
"(",
... | Method called to do initial normalization of the default attribute
value, without trying to verify its validity. Thus, it's
called independent of whether we are fully validating the document. | [
"Method",
"called",
"to",
"do",
"initial",
"normalization",
"of",
"the",
"default",
"attribute",
"value",
"without",
"trying",
"to",
"verify",
"its",
"validity",
".",
"Thus",
"it",
"s",
"called",
"independent",
"of",
"whether",
"we",
"are",
"fully",
"validatin... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDAttribute.java#L274-L284 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDAttribute.java | DTDAttribute.reportValidationProblem | protected String reportValidationProblem(InputProblemReporter rep, String msg)
throws XMLStreamException
{
rep.reportValidationProblem("Attribute definition '"+mName+"': "+msg);
return null;
} | java | protected String reportValidationProblem(InputProblemReporter rep, String msg)
throws XMLStreamException
{
rep.reportValidationProblem("Attribute definition '"+mName+"': "+msg);
return null;
} | [
"protected",
"String",
"reportValidationProblem",
"(",
"InputProblemReporter",
"rep",
",",
"String",
"msg",
")",
"throws",
"XMLStreamException",
"{",
"rep",
".",
"reportValidationProblem",
"(",
"\"Attribute definition '\"",
"+",
"mName",
"+",
"\"': \"",
"+",
"msg",
")... | Method called during parsing of DTD schema, to report a problem.
Note that unlike during actual validation, we have no option of
just gracefully listing problems and ignoring them; an exception
is always thrown. | [
"Method",
"called",
"during",
"parsing",
"of",
"DTD",
"schema",
"to",
"report",
"a",
"problem",
".",
"Note",
"that",
"unlike",
"during",
"actual",
"validation",
"we",
"have",
"no",
"option",
"of",
"just",
"gracefully",
"listing",
"problems",
"and",
"ignoring",... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDAttribute.java#L505-L510 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dom/WstxDOMWrappingWriter.java | WstxDOMWrappingWriter.createStartElem | protected void createStartElem(String nsURI, String prefix, String localName, boolean isEmpty)
throws XMLStreamException
{
DOMOutputElement elem;
if (!mNsAware) {
if(nsURI != null && nsURI.length() > 0) {
throwOutputError("Can not specify non-empty uri/prefix in ... | java | protected void createStartElem(String nsURI, String prefix, String localName, boolean isEmpty)
throws XMLStreamException
{
DOMOutputElement elem;
if (!mNsAware) {
if(nsURI != null && nsURI.length() > 0) {
throwOutputError("Can not specify non-empty uri/prefix in ... | [
"protected",
"void",
"createStartElem",
"(",
"String",
"nsURI",
",",
"String",
"prefix",
",",
"String",
"localName",
",",
"boolean",
"isEmpty",
")",
"throws",
"XMLStreamException",
"{",
"DOMOutputElement",
"elem",
";",
"if",
"(",
"!",
"mNsAware",
")",
"{",
"if... | Method called by all start element write methods.
@param nsURI Namespace URI to use: null and empty String denote 'no namespace' | [
"Method",
"called",
"by",
"all",
"start",
"element",
"write",
"methods",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dom/WstxDOMWrappingWriter.java#L472-L545 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/NonNsStreamWriter.java | NonNsStreamWriter.copyStartElement | @Override
public void copyStartElement(InputElementStack elemStack,
AttributeCollector attrCollector)
throws IOException, XMLStreamException
{
String ln = elemStack.getLocalName();
boolean nsAware = elemStack.isNamespaceAware();
/* First,... | java | @Override
public void copyStartElement(InputElementStack elemStack,
AttributeCollector attrCollector)
throws IOException, XMLStreamException
{
String ln = elemStack.getLocalName();
boolean nsAware = elemStack.isNamespaceAware();
/* First,... | [
"@",
"Override",
"public",
"void",
"copyStartElement",
"(",
"InputElementStack",
"elemStack",
",",
"AttributeCollector",
"attrCollector",
")",
"throws",
"IOException",
",",
"XMLStreamException",
"{",
"String",
"ln",
"=",
"elemStack",
".",
"getLocalName",
"(",
")",
"... | Element copier method implementation suitable to be used with
non-namespace-aware writers. The only special thing here is that
the copier can convert namespace declarations to equivalent
attribute writes. | [
"Element",
"copier",
"method",
"implementation",
"suitable",
"to",
"be",
"used",
"with",
"non",
"-",
"namespace",
"-",
"aware",
"writers",
".",
"The",
"only",
"special",
"thing",
"here",
"is",
"that",
"the",
"copier",
"can",
"convert",
"namespace",
"declaratio... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/NonNsStreamWriter.java#L363-L412 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/WstxInputData.java | WstxInputData.findIllegalNameChar | public final static int findIllegalNameChar(String name, boolean nsAware, boolean xml11)
{
int len = name.length();
if (len < 1) {
return -1;
}
char c = name.charAt(0);
// First char legal?
if (c <= 0x7A) { // 'z' or earlier
if (c < 0... | java | public final static int findIllegalNameChar(String name, boolean nsAware, boolean xml11)
{
int len = name.length();
if (len < 1) {
return -1;
}
char c = name.charAt(0);
// First char legal?
if (c <= 0x7A) { // 'z' or earlier
if (c < 0... | [
"public",
"final",
"static",
"int",
"findIllegalNameChar",
"(",
"String",
"name",
",",
"boolean",
"nsAware",
",",
"boolean",
"xml11",
")",
"{",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"<",
"1",
")",
"{",
"return",
"... | Method that can be called to check whether given String contains
any characters that are not legal XML names.
@return Index of the first illegal xml name characters, if any;
-1 if the name is completely legal | [
"Method",
"that",
"can",
"be",
"called",
"to",
"check",
"whether",
"given",
"String",
"contains",
"any",
"characters",
"that",
"are",
"not",
"legal",
"XML",
"names",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/WstxInputData.java#L340-L409 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/CharsetNames.java | CharsetNames.findEncodingFor | public static String findEncodingFor(Writer w)
{
if (w instanceof OutputStreamWriter) {
String enc = ((OutputStreamWriter) w).getEncoding();
/* [WSTX-146]: It is important that we normalize this, since
* older JDKs return legacy encoding names ("UTF8" instead of
... | java | public static String findEncodingFor(Writer w)
{
if (w instanceof OutputStreamWriter) {
String enc = ((OutputStreamWriter) w).getEncoding();
/* [WSTX-146]: It is important that we normalize this, since
* older JDKs return legacy encoding names ("UTF8" instead of
... | [
"public",
"static",
"String",
"findEncodingFor",
"(",
"Writer",
"w",
")",
"{",
"if",
"(",
"w",
"instanceof",
"OutputStreamWriter",
")",
"{",
"String",
"enc",
"=",
"(",
"(",
"OutputStreamWriter",
")",
"w",
")",
".",
"getEncoding",
"(",
")",
";",
"/* [WSTX-1... | Because of legacy encodings used by earlier JDK versions, we
need to be careful when accessing encoding names via JDK
classes. | [
"Because",
"of",
"legacy",
"encodings",
"used",
"by",
"earlier",
"JDK",
"versions",
"we",
"need",
"to",
"be",
"careful",
"when",
"accessing",
"encoding",
"names",
"via",
"JDK",
"classes",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/CharsetNames.java#L282-L293 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/ExceptionUtil.java | ExceptionUtil.throwRuntimeException | public static void throwRuntimeException(Throwable t)
{
// Unchecked? Can re-throw as is
throwIfUnchecked(t);
// Otherwise, let's just change its type:
throw new RuntimeException("[was "+t.getClass()+"] "+t.getMessage(), t);
} | java | public static void throwRuntimeException(Throwable t)
{
// Unchecked? Can re-throw as is
throwIfUnchecked(t);
// Otherwise, let's just change its type:
throw new RuntimeException("[was "+t.getClass()+"] "+t.getMessage(), t);
} | [
"public",
"static",
"void",
"throwRuntimeException",
"(",
"Throwable",
"t",
")",
"{",
"// Unchecked? Can re-throw as is",
"throwIfUnchecked",
"(",
"t",
")",
";",
"// Otherwise, let's just change its type:",
"throw",
"new",
"RuntimeException",
"(",
"\"[was \"",
"+",
"t",
... | Method that can be used to convert any Throwable to a RuntimeException;
conversion is only done for checked exceptions. | [
"Method",
"that",
"can",
"be",
"used",
"to",
"convert",
"any",
"Throwable",
"to",
"a",
"RuntimeException",
";",
"conversion",
"is",
"only",
"done",
"for",
"checked",
"exceptions",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/ExceptionUtil.java#L13-L19 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/StringUtil.java | StringUtil.trimEncoding | public static String trimEncoding(String str, boolean upperCase)
{
int i = 0;
int len = str.length();
// Let's first check if String is fine as is:
for (; i < len; ++i) {
char c = str.charAt(i);
if (c <= CHAR_SPACE || !Character.isLetterOrDigit(c)) {
... | java | public static String trimEncoding(String str, boolean upperCase)
{
int i = 0;
int len = str.length();
// Let's first check if String is fine as is:
for (; i < len; ++i) {
char c = str.charAt(i);
if (c <= CHAR_SPACE || !Character.isLetterOrDigit(c)) {
... | [
"public",
"static",
"String",
"trimEncoding",
"(",
"String",
"str",
",",
"boolean",
"upperCase",
")",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"// Let's first check if String is fine as is:",
"for",
"(",
";",
... | Method that will remove all non-alphanumeric characters, and optionally
upper-case included letters, from the given String. | [
"Method",
"that",
"will",
"remove",
"all",
"non",
"-",
"alphanumeric",
"characters",
"and",
"optionally",
"upper",
"-",
"case",
"included",
"letters",
"from",
"the",
"given",
"String",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/StringUtil.java#L280-L313 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/URLUtil.java | URLUtil.urlFromCurrentDir | public static URL urlFromCurrentDir()
throws IOException /* MalformedURLException or such */
{
/* This seems to work; independent of whether there happens to
* be such/file dir or not.
*/
File parent = new File("a").getAbsoluteFile().getParentFile();
return toURL(pa... | java | public static URL urlFromCurrentDir()
throws IOException /* MalformedURLException or such */
{
/* This seems to work; independent of whether there happens to
* be such/file dir or not.
*/
File parent = new File("a").getAbsoluteFile().getParentFile();
return toURL(pa... | [
"public",
"static",
"URL",
"urlFromCurrentDir",
"(",
")",
"throws",
"IOException",
"/* MalformedURLException or such */",
"{",
"/* This seems to work; independent of whether there happens to\n * be such/file dir or not.\n */",
"File",
"parent",
"=",
"new",
"File",
"("... | Method that tries to create and return URL that denotes current
working directory. Usually used to create a context, when one is
not explicitly passed. | [
"Method",
"that",
"tries",
"to",
"create",
"and",
"return",
"URL",
"that",
"denotes",
"current",
"working",
"directory",
".",
"Usually",
"used",
"to",
"create",
"a",
"context",
"when",
"one",
"is",
"not",
"explicitly",
"passed",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/URLUtil.java#L120-L128 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/URLUtil.java | URLUtil.throwIOException | private static void throwIOException(Exception mex, String sysId)
throws IOException
{
String msg = "[resolving systemId '"+sysId+"']: "+mex.toString();
throw ExceptionUtil.constructIOException(msg, mex);
} | java | private static void throwIOException(Exception mex, String sysId)
throws IOException
{
String msg = "[resolving systemId '"+sysId+"']: "+mex.toString();
throw ExceptionUtil.constructIOException(msg, mex);
} | [
"private",
"static",
"void",
"throwIOException",
"(",
"Exception",
"mex",
",",
"String",
"sysId",
")",
"throws",
"IOException",
"{",
"String",
"msg",
"=",
"\"[resolving systemId '\"",
"+",
"sysId",
"+",
"\"']: \"",
"+",
"mex",
".",
"toString",
"(",
")",
";",
... | Helper method that tries to fully convert strange URL-specific exception
to more general IO exception. Also, to try to use JDK 1.4 feature without
creating requirement, uses reflection to try to set the root cause, if
we are running on JDK1.4 | [
"Helper",
"method",
"that",
"tries",
"to",
"fully",
"convert",
"strange",
"URL",
"-",
"specific",
"exception",
"to",
"more",
"general",
"IO",
"exception",
".",
"Also",
"to",
"try",
"to",
"use",
"JDK",
"1",
".",
"4",
"feature",
"without",
"creating",
"requi... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/URLUtil.java#L215-L220 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/stax/WstxEventFactory.java | WstxEventFactory.createStartElement | @SuppressWarnings("unchecked")
@Override
protected StartElement createStartElement(QName name, Iterator<?> attr,
Iterator<?> ns, NamespaceContext ctxt)
{
return SimpleStartElement.construct(mLocation, name,
(Iterator<Attribute>) attr,
(Iterator<Namespace>)... | java | @SuppressWarnings("unchecked")
@Override
protected StartElement createStartElement(QName name, Iterator<?> attr,
Iterator<?> ns, NamespaceContext ctxt)
{
return SimpleStartElement.construct(mLocation, name,
(Iterator<Attribute>) attr,
(Iterator<Namespace>)... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"protected",
"StartElement",
"createStartElement",
"(",
"QName",
"name",
",",
"Iterator",
"<",
"?",
">",
"attr",
",",
"Iterator",
"<",
"?",
">",
"ns",
",",
"NamespaceContext",
"ctxt",
")",
... | Must override this method to use a more efficient StartElement
implementation | [
"Must",
"override",
"this",
"method",
"to",
"use",
"a",
"more",
"efficient",
"StartElement",
"implementation"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxEventFactory.java#L115-L123 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/DefaultInputResolver.java | DefaultInputResolver.resolveEntity | public static WstxInputSource resolveEntity
(WstxInputSource parent, URL pathCtxt, String entityName,
String publicId, String systemId,
XMLResolver customResolver, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException
{
if (pathCtxt == null) {
... | java | public static WstxInputSource resolveEntity
(WstxInputSource parent, URL pathCtxt, String entityName,
String publicId, String systemId,
XMLResolver customResolver, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException
{
if (pathCtxt == null) {
... | [
"public",
"static",
"WstxInputSource",
"resolveEntity",
"(",
"WstxInputSource",
"parent",
",",
"URL",
"pathCtxt",
",",
"String",
"entityName",
",",
"String",
"publicId",
",",
"String",
"systemId",
",",
"XMLResolver",
"customResolver",
",",
"ReaderConfig",
"cfg",
","... | Basic external resource resolver implementation; usable both with
DTD and entity resolution.
@param parent Input source that contains reference to be expanded.
@param pathCtxt Reference context to use for resolving path, if
known. If null, reference context of the parent will
be used; and if that is null (which is pos... | [
"Basic",
"external",
"resource",
"resolver",
"implementation",
";",
"usable",
"both",
"with",
"DTD",
"and",
"entity",
"resolution",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/DefaultInputResolver.java#L64-L93 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/DefaultInputResolver.java | DefaultInputResolver.resolveEntityUsing | public static WstxInputSource resolveEntityUsing
(WstxInputSource refCtxt, String entityName,
String publicId, String systemId,
XMLResolver resolver, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException
{
URL ctxt = (refCtxt == null) ? null : refCtxt.get... | java | public static WstxInputSource resolveEntityUsing
(WstxInputSource refCtxt, String entityName,
String publicId, String systemId,
XMLResolver resolver, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException
{
URL ctxt = (refCtxt == null) ? null : refCtxt.get... | [
"public",
"static",
"WstxInputSource",
"resolveEntityUsing",
"(",
"WstxInputSource",
"refCtxt",
",",
"String",
"entityName",
",",
"String",
"publicId",
",",
"String",
"systemId",
",",
"XMLResolver",
"resolver",
",",
"ReaderConfig",
"cfg",
",",
"int",
"xmlVersion",
"... | A very simple utility expansion method used generally when the
only way to resolve an entity is via passed resolver; and where
failing to resolve it is not fatal. | [
"A",
"very",
"simple",
"utility",
"expansion",
"method",
"used",
"generally",
"when",
"the",
"only",
"way",
"to",
"resolve",
"an",
"entity",
"is",
"via",
"passed",
"resolver",
";",
"and",
"where",
"failing",
"to",
"resolve",
"it",
"is",
"not",
"fatal",
"."... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/DefaultInputResolver.java#L100-L112 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java | ValidatingStreamReader.reportValidationProblem | @Override
public void reportValidationProblem(XMLValidationProblem prob)
throws XMLStreamException
{
if (mVldProbHandler != null) {
// Fix for [WSTX-209]
mVldProbHandler.reportProblem(prob);
} else {
super.reportValidationProblem(prob);
}
} | java | @Override
public void reportValidationProblem(XMLValidationProblem prob)
throws XMLStreamException
{
if (mVldProbHandler != null) {
// Fix for [WSTX-209]
mVldProbHandler.reportProblem(prob);
} else {
super.reportValidationProblem(prob);
}
} | [
"@",
"Override",
"public",
"void",
"reportValidationProblem",
"(",
"XMLValidationProblem",
"prob",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"mVldProbHandler",
"!=",
"null",
")",
"{",
"// Fix for [WSTX-209]",
"mVldProbHandler",
".",
"reportProblem",
"(",
"p... | If there is an error handler established, call it. | [
"If",
"there",
"is",
"an",
"error",
"handler",
"established",
"call",
"it",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java#L375-L385 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java | ValidatingStreamReader.resolveExtSubsetPath | private URI resolveExtSubsetPath(String systemId) throws IOException
{
// Do we have a context to use for resolving?
URL ctxt = (mInput == null) ? null : mInput.getSource();
/* Ok, either got a context or not; let's create the URL based on
* the id, and optional context:
*... | java | private URI resolveExtSubsetPath(String systemId) throws IOException
{
// Do we have a context to use for resolving?
URL ctxt = (mInput == null) ? null : mInput.getSource();
/* Ok, either got a context or not; let's create the URL based on
* the id, and optional context:
*... | [
"private",
"URI",
"resolveExtSubsetPath",
"(",
"String",
"systemId",
")",
"throws",
"IOException",
"{",
"// Do we have a context to use for resolving?",
"URL",
"ctxt",
"=",
"(",
"mInput",
"==",
"null",
")",
"?",
"null",
":",
"mInput",
".",
"getSource",
"(",
")",
... | Method called to resolve path to external DTD subset, given
system identifier. | [
"Method",
"called",
"to",
"resolve",
"path",
"to",
"external",
"DTD",
"subset",
"given",
"system",
"identifier",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java#L507-L528 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/StreamBootstrapper.java | StreamBootstrapper.getInstance | public static StreamBootstrapper getInstance(String pubId, SystemId sysId, InputStream in)
{
return new StreamBootstrapper(pubId, sysId, in);
} | java | public static StreamBootstrapper getInstance(String pubId, SystemId sysId, InputStream in)
{
return new StreamBootstrapper(pubId, sysId, in);
} | [
"public",
"static",
"StreamBootstrapper",
"getInstance",
"(",
"String",
"pubId",
",",
"SystemId",
"sysId",
",",
"InputStream",
"in",
")",
"{",
"return",
"new",
"StreamBootstrapper",
"(",
"pubId",
",",
"sysId",
",",
"in",
")",
";",
"}"
] | Factory method used when the underlying data provider is an
actual stream. | [
"Factory",
"method",
"used",
"when",
"the",
"underlying",
"data",
"provider",
"is",
"an",
"actual",
"stream",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/StreamBootstrapper.java#L136-L139 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/StreamBootstrapper.java | StreamBootstrapper.getInstance | public static StreamBootstrapper getInstance(String pubId, SystemId sysId, byte[] data, int start, int end)
{
return new StreamBootstrapper(pubId, sysId, data, start, end);
} | java | public static StreamBootstrapper getInstance(String pubId, SystemId sysId, byte[] data, int start, int end)
{
return new StreamBootstrapper(pubId, sysId, data, start, end);
} | [
"public",
"static",
"StreamBootstrapper",
"getInstance",
"(",
"String",
"pubId",
",",
"SystemId",
"sysId",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"new",
"StreamBootstrapper",
"(",
"pubId",
",",
"sysId",
"... | Factory method used when the underlying data provider is a pre-allocated
block source, and no stream is used.
Additionally the buffer passed is not owned by the bootstrapper
or Reader that is created, so it is not to be recycled. | [
"Factory",
"method",
"used",
"when",
"the",
"underlying",
"data",
"provider",
"is",
"a",
"pre",
"-",
"allocated",
"block",
"source",
"and",
"no",
"stream",
"is",
"used",
".",
"Additionally",
"the",
"buffer",
"passed",
"is",
"not",
"owned",
"by",
"the",
"bo... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/StreamBootstrapper.java#L147-L150 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/StreamBootstrapper.java | StreamBootstrapper.resolveStreamEncoding | protected void resolveStreamEncoding()
throws IOException, WstxException
{
// Let's first set defaults:
mBytesPerChar = 0;
mBigEndian = true;
/* Ok; first just need 4 bytes for determining bytes-per-char from
* BOM or first char(s) of likely xml declaration:
... | java | protected void resolveStreamEncoding()
throws IOException, WstxException
{
// Let's first set defaults:
mBytesPerChar = 0;
mBigEndian = true;
/* Ok; first just need 4 bytes for determining bytes-per-char from
* BOM or first char(s) of likely xml declaration:
... | [
"protected",
"void",
"resolveStreamEncoding",
"(",
")",
"throws",
"IOException",
",",
"WstxException",
"{",
"// Let's first set defaults:",
"mBytesPerChar",
"=",
"0",
";",
"mBigEndian",
"=",
"true",
";",
"/* Ok; first just need 4 bytes for determining bytes-per-char from\n ... | Method called to try to figure out physical encoding the underlying
input stream uses. | [
"Method",
"called",
"to",
"try",
"to",
"figure",
"out",
"physical",
"encoding",
"the",
"underlying",
"input",
"stream",
"uses",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/StreamBootstrapper.java#L296-L421 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDSchemaFactory.java | DTDSchemaFactory.doCreateSchema | @SuppressWarnings("resource")
protected XMLValidationSchema doCreateSchema
(ReaderConfig rcfg, InputBootstrapper bs, String publicId, String systemIdStr, URL ctxt)
throws XMLStreamException
{
try {
Reader r = bs.bootstrapInput(rcfg, false, XmlConsts.XML_V_UNKNOWN);
... | java | @SuppressWarnings("resource")
protected XMLValidationSchema doCreateSchema
(ReaderConfig rcfg, InputBootstrapper bs, String publicId, String systemIdStr, URL ctxt)
throws XMLStreamException
{
try {
Reader r = bs.bootstrapInput(rcfg, false, XmlConsts.XML_V_UNKNOWN);
... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"protected",
"XMLValidationSchema",
"doCreateSchema",
"(",
"ReaderConfig",
"rcfg",
",",
"InputBootstrapper",
"bs",
",",
"String",
"publicId",
",",
"String",
"systemIdStr",
",",
"URL",
"ctxt",
")",
"throws",
"XMLStre... | The main validator construction method, called by all externally
visible methods. | [
"The",
"main",
"validator",
"construction",
"method",
"called",
"by",
"all",
"externally",
"visible",
"methods",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDSchemaFactory.java#L168-L198 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/ReaderSource.java | ReaderSource.doInitInputLocation | @Override
protected void doInitInputLocation(WstxInputData reader)
{
reader.mCurrInputProcessed = mInputProcessed;
reader.mCurrInputRow = mInputRow;
reader.mCurrInputRowStart = mInputRowStart;
} | java | @Override
protected void doInitInputLocation(WstxInputData reader)
{
reader.mCurrInputProcessed = mInputProcessed;
reader.mCurrInputRow = mInputRow;
reader.mCurrInputRowStart = mInputRowStart;
} | [
"@",
"Override",
"protected",
"void",
"doInitInputLocation",
"(",
"WstxInputData",
"reader",
")",
"{",
"reader",
".",
"mCurrInputProcessed",
"=",
"mInputProcessed",
";",
"reader",
".",
"mCurrInputRow",
"=",
"mInputRow",
";",
"reader",
".",
"mCurrInputRowStart",
"=",... | Input location is easy to set, as we'll start from the beginning
of a File. | [
"Input",
"location",
"is",
"easy",
"to",
"set",
"as",
"we",
"ll",
"start",
"from",
"the",
"beginning",
"of",
"a",
"File",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/ReaderSource.java#L62-L68 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/BijectiveNsMap.java | BijectiveNsMap.addMapping | public String addMapping(String prefix, String uri)
{
String[] strs = mNsStrings;
int phash = prefix.hashCode();
for (int ix = mScopeStart, end = mScopeEnd; ix < end; ix += 2) {
String thisP = strs[ix];
if (thisP == prefix ||
(thisP.hashCode() == phas... | java | public String addMapping(String prefix, String uri)
{
String[] strs = mNsStrings;
int phash = prefix.hashCode();
for (int ix = mScopeStart, end = mScopeEnd; ix < end; ix += 2) {
String thisP = strs[ix];
if (thisP == prefix ||
(thisP.hashCode() == phas... | [
"public",
"String",
"addMapping",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"String",
"[",
"]",
"strs",
"=",
"mNsStrings",
";",
"int",
"phash",
"=",
"prefix",
".",
"hashCode",
"(",
")",
";",
"for",
"(",
"int",
"ix",
"=",
"mScopeStart",
... | Method to add a new prefix-to-URI mapping for the current scope.
Note that it should NOT be used for the default namespace
declaration
@param prefix Prefix to bind
@param uri URI to bind to the prefix
@return If the prefix was already bound, the URI it was bound to:
null if it's a new binding for the current scope. | [
"Method",
"to",
"add",
"a",
"new",
"prefix",
"-",
"to",
"-",
"URI",
"mapping",
"for",
"the",
"current",
"scope",
".",
"Note",
"that",
"it",
"should",
"NOT",
"be",
"used",
"for",
"the",
"default",
"namespace",
"declaration"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/BijectiveNsMap.java#L226-L251 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/BijectiveNsMap.java | BijectiveNsMap.addGeneratedMapping | public String addGeneratedMapping(String prefixBase, NamespaceContext ctxt,
String uri, int[] seqArr)
{
String[] strs = mNsStrings;
int seqNr = seqArr[0];
String prefix;
main_loop:
while (true) {
/* We better intern the resul... | java | public String addGeneratedMapping(String prefixBase, NamespaceContext ctxt,
String uri, int[] seqArr)
{
String[] strs = mNsStrings;
int seqNr = seqArr[0];
String prefix;
main_loop:
while (true) {
/* We better intern the resul... | [
"public",
"String",
"addGeneratedMapping",
"(",
"String",
"prefixBase",
",",
"NamespaceContext",
"ctxt",
",",
"String",
"uri",
",",
"int",
"[",
"]",
"seqArr",
")",
"{",
"String",
"[",
"]",
"strs",
"=",
"mNsStrings",
";",
"int",
"seqNr",
"=",
"seqArr",
"[",... | Method used to add a dynamic binding, and return the prefix
used to bind the specified namespace URI. | [
"Method",
"used",
"to",
"add",
"a",
"dynamic",
"binding",
"and",
"return",
"the",
"prefix",
"used",
"to",
"bind",
"the",
"specified",
"namespace",
"URI",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/BijectiveNsMap.java#L257-L307 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/TypedStreamReader.java | TypedStreamReader.getAttributeAsArray | @Override
public int getAttributeAsArray(int index, TypedArrayDecoder tad) throws XMLStreamException
{
if (mCurrToken != START_ELEMENT) {
throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM);
}
return mAttrCollector.decodeValues(index, tad, this);
} | java | @Override
public int getAttributeAsArray(int index, TypedArrayDecoder tad) throws XMLStreamException
{
if (mCurrToken != START_ELEMENT) {
throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM);
}
return mAttrCollector.decodeValues(index, tad, this);
} | [
"@",
"Override",
"public",
"int",
"getAttributeAsArray",
"(",
"int",
"index",
",",
"TypedArrayDecoder",
"tad",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"mCurrToken",
"!=",
"START_ELEMENT",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"ErrorC... | Method that allows reading contents of an attribute as an array
of whitespace-separate tokens, decoded using specified decoder.
@return Number of tokens decoded, 0 if none found | [
"Method",
"that",
"allows",
"reading",
"contents",
"of",
"an",
"attribute",
"as",
"an",
"array",
"of",
"whitespace",
"-",
"separate",
"tokens",
"decoded",
"using",
"specified",
"decoder",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/TypedStreamReader.java#L694-L701 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/ReaderBootstrapper.java | ReaderBootstrapper.bootstrapInput | @Override
public Reader bootstrapInput(ReaderConfig cfg, boolean mainDoc, int xmlVersion)
throws IOException, XMLStreamException
{
/* First order of business: allocate input buffer. Not done during
* construction for simplicity; that way config object need not be
* passed befor... | java | @Override
public Reader bootstrapInput(ReaderConfig cfg, boolean mainDoc, int xmlVersion)
throws IOException, XMLStreamException
{
/* First order of business: allocate input buffer. Not done during
* construction for simplicity; that way config object need not be
* passed befor... | [
"@",
"Override",
"public",
"Reader",
"bootstrapInput",
"(",
"ReaderConfig",
"cfg",
",",
"boolean",
"mainDoc",
",",
"int",
"xmlVersion",
")",
"throws",
"IOException",
",",
"XMLStreamException",
"{",
"/* First order of business: allocate input buffer. Not done during\n ... | Method called to do actual bootstrapping.
@return Actual reader to use for reading xml content | [
"Method",
"called",
"to",
"do",
"actual",
"bootstrapping",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/ReaderBootstrapper.java#L119-L188 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.getValueByLocalName | public String getValueByLocalName(String localName)
{
// NOTE: can't use hashing, must do linear scan
switch (mAttrCount) {
case 4:
if (mAttributes[0].hasLocalName(localName)) return getValue(0);
if (mAttributes[1].hasLocalName(localName)) return getValue(1);... | java | public String getValueByLocalName(String localName)
{
// NOTE: can't use hashing, must do linear scan
switch (mAttrCount) {
case 4:
if (mAttributes[0].hasLocalName(localName)) return getValue(0);
if (mAttributes[1].hasLocalName(localName)) return getValue(1);... | [
"public",
"String",
"getValueByLocalName",
"(",
"String",
"localName",
")",
"{",
"// NOTE: can't use hashing, must do linear scan",
"switch",
"(",
"mAttrCount",
")",
"{",
"case",
"4",
":",
"if",
"(",
"mAttributes",
"[",
"0",
"]",
".",
"hasLocalName",
"(",
"localNa... | Specialized version in which namespace information is completely ignored.
@since 5.2 | [
"Specialized",
"version",
"in",
"which",
"namespace",
"information",
"is",
"completely",
"ignored",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L421-L454 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.decodeValue | public final void decodeValue(int index, TypedValueDecoder tvd)
throws IllegalArgumentException
{
if (index < 0 || index >= mAttrCount) {
throwIndex(index);
}
/* Should be faster to pass the char array even if we might
* have a String
*/
// Eithe... | java | public final void decodeValue(int index, TypedValueDecoder tvd)
throws IllegalArgumentException
{
if (index < 0 || index >= mAttrCount) {
throwIndex(index);
}
/* Should be faster to pass the char array even if we might
* have a String
*/
// Eithe... | [
"public",
"final",
"void",
"decodeValue",
"(",
"int",
"index",
",",
"TypedValueDecoder",
"tvd",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"mAttrCount",
")",
"{",
"throwIndex",
"(",
"index",
")",
";",
... | Method called to decode the whole attribute value as a single
typed value.
Decoding is done using the decoder provided. | [
"Method",
"called",
"to",
"decode",
"the",
"whole",
"attribute",
"value",
"as",
"a",
"single",
"typed",
"value",
".",
"Decoding",
"is",
"done",
"using",
"the",
"decoder",
"provided",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L537-L564 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.decodeValues | public final int decodeValues(int index, TypedArrayDecoder tad,
InputProblemReporter rep)
throws XMLStreamException
{
if (index < 0 || index >= mAttrCount) {
throwIndex(index);
}
// Char[] faster than String... and no need to trim here:
... | java | public final int decodeValues(int index, TypedArrayDecoder tad,
InputProblemReporter rep)
throws XMLStreamException
{
if (index < 0 || index >= mAttrCount) {
throwIndex(index);
}
// Char[] faster than String... and no need to trim here:
... | [
"public",
"final",
"int",
"decodeValues",
"(",
"int",
"index",
",",
"TypedArrayDecoder",
"tad",
",",
"InputProblemReporter",
"rep",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"mAttrCount",
")",
"{",
"throwIndex... | Method called to decode the attribute value that consists of
zero or more space-separated tokens.
Decoding is done using the decoder provided.
@return Number of tokens decoded | [
"Method",
"called",
"to",
"decode",
"the",
"attribute",
"value",
"that",
"consists",
"of",
"zero",
"or",
"more",
"space",
"-",
"separated",
"tokens",
".",
"Decoding",
"is",
"done",
"using",
"the",
"decoder",
"provided",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L572-L584 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.checkExpand | private final static boolean checkExpand(TypedArrayDecoder tad)
{
if (tad instanceof ValueDecoderFactory.BaseArrayDecoder) {
((ValueDecoderFactory.BaseArrayDecoder) tad).expand();
return true;
}
return false;
} | java | private final static boolean checkExpand(TypedArrayDecoder tad)
{
if (tad instanceof ValueDecoderFactory.BaseArrayDecoder) {
((ValueDecoderFactory.BaseArrayDecoder) tad).expand();
return true;
}
return false;
} | [
"private",
"final",
"static",
"boolean",
"checkExpand",
"(",
"TypedArrayDecoder",
"tad",
")",
"{",
"if",
"(",
"tad",
"instanceof",
"ValueDecoderFactory",
".",
"BaseArrayDecoder",
")",
"{",
"(",
"(",
"ValueDecoderFactory",
".",
"BaseArrayDecoder",
")",
"tad",
")",
... | Internal method used to see if we can expand the buffer that
the array decoder has. Bit messy, but simpler than having
separately typed instances; and called rarely so that performance
downside of instanceof is irrelevant. | [
"Internal",
"method",
"used",
"to",
"see",
"if",
"we",
"can",
"expand",
"the",
"buffer",
"that",
"the",
"array",
"decoder",
"has",
".",
"Bit",
"messy",
"but",
"simpler",
"than",
"having",
"separately",
"typed",
"instances",
";",
"and",
"called",
"rarely",
... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L659-L666 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.resolveNamespaceDecl | protected Attribute resolveNamespaceDecl(int index, boolean internURI)
{
Attribute ns = mNamespaces[index];
String full = mNamespaceBuilder.getAllValues();
String uri;
if (mNsCount == 0) {
uri = full;
} else {
++index;
if (index < mNsCount... | java | protected Attribute resolveNamespaceDecl(int index, boolean internURI)
{
Attribute ns = mNamespaces[index];
String full = mNamespaceBuilder.getAllValues();
String uri;
if (mNsCount == 0) {
uri = full;
} else {
++index;
if (index < mNsCount... | [
"protected",
"Attribute",
"resolveNamespaceDecl",
"(",
"int",
"index",
",",
"boolean",
"internURI",
")",
"{",
"Attribute",
"ns",
"=",
"mNamespaces",
"[",
"index",
"]",
";",
"String",
"full",
"=",
"mNamespaceBuilder",
".",
"getAllValues",
"(",
")",
";",
"String... | Method called to resolve and initialize specified collected
namespace declaration
@return Attribute that contains specified namespace declaration | [
"Method",
"called",
"to",
"resolve",
"and",
"initialize",
"specified",
"collected",
"namespace",
"declaration"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L698-L720 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.addDefaultAttribute | public int addDefaultAttribute(String localName, String uri, String prefix,
String value) throws XMLStreamException
{
int attrIndex = mAttrCount;
if (attrIndex < 1) {
/* had no explicit attributes... better initialize now, then.
* Let's jus... | java | public int addDefaultAttribute(String localName, String uri, String prefix,
String value) throws XMLStreamException
{
int attrIndex = mAttrCount;
if (attrIndex < 1) {
/* had no explicit attributes... better initialize now, then.
* Let's jus... | [
"public",
"int",
"addDefaultAttribute",
"(",
"String",
"localName",
",",
"String",
"uri",
",",
"String",
"prefix",
",",
"String",
"value",
")",
"throws",
"XMLStreamException",
"{",
"int",
"attrIndex",
"=",
"mAttrCount",
";",
"if",
"(",
"attrIndex",
"<",
"1",
... | Method called by validator to insert an attribute that has a default
value and wasn't yet included in collector's attribute set.
@return Index of the newly added attribute, if added; -1 to indicate
this was a duplicate | [
"Method",
"called",
"by",
"validator",
"to",
"insert",
"an",
"attribute",
"that",
"has",
"a",
"default",
"value",
"and",
"wasn",
"t",
"yet",
"included",
"in",
"collector",
"s",
"attribute",
"set",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L836-L881 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.allocBuffers | protected final void allocBuffers()
{
if (mAttributes == null) {
mAttributes = new Attribute[8];
}
if (mValueBuilder == null) {
mValueBuilder = new TextBuilder(EXP_ATTR_COUNT);
}
} | java | protected final void allocBuffers()
{
if (mAttributes == null) {
mAttributes = new Attribute[8];
}
if (mValueBuilder == null) {
mValueBuilder = new TextBuilder(EXP_ATTR_COUNT);
}
} | [
"protected",
"final",
"void",
"allocBuffers",
"(",
")",
"{",
"if",
"(",
"mAttributes",
"==",
"null",
")",
"{",
"mAttributes",
"=",
"new",
"Attribute",
"[",
"8",
"]",
";",
"}",
"if",
"(",
"mValueBuilder",
"==",
"null",
")",
"{",
"mValueBuilder",
"=",
"n... | Method called to initialize buffers that need not be immediately
initialized | [
"Method",
"called",
"to",
"initialize",
"buffers",
"that",
"need",
"not",
"be",
"immediately",
"initialized"
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L1113-L1121 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/MinimalDTDReader.java | MinimalDTDReader.skipInternalSubset | protected void skipInternalSubset()
throws XMLStreamException
{
while (true) {
int i = getNextAfterWS();
if (i < 0) {
// Error for internal subset
throwUnexpectedEOF(SUFFIX_IN_DTD_INTERNAL);
}
if (i == '%') { // paramete... | java | protected void skipInternalSubset()
throws XMLStreamException
{
while (true) {
int i = getNextAfterWS();
if (i < 0) {
// Error for internal subset
throwUnexpectedEOF(SUFFIX_IN_DTD_INTERNAL);
}
if (i == '%') { // paramete... | [
"protected",
"void",
"skipInternalSubset",
"(",
")",
"throws",
"XMLStreamException",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"i",
"=",
"getNextAfterWS",
"(",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"// Error for internal subset",
"throwUnexpectedEOF"... | Method that will skip through internal DTD subset, without doing
any parsing, except for trying to match end of subset properly. | [
"Method",
"that",
"will",
"skip",
"through",
"internal",
"DTD",
"subset",
"without",
"doing",
"any",
"parsing",
"except",
"for",
"trying",
"to",
"match",
"end",
"of",
"subset",
"properly",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/MinimalDTDReader.java#L179-L243 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/CharArraySource.java | CharArraySource.doInitInputLocation | @Override
protected void doInitInputLocation(WstxInputData reader)
{
reader.mCurrInputProcessed = mContentStart.getCharacterOffset();
reader.mCurrInputRow = mContentStart.getLineNumber();
/* 13-Apr-2005, TSa: Since column offsets reported by Location
* objects are 1-based, but... | java | @Override
protected void doInitInputLocation(WstxInputData reader)
{
reader.mCurrInputProcessed = mContentStart.getCharacterOffset();
reader.mCurrInputRow = mContentStart.getLineNumber();
/* 13-Apr-2005, TSa: Since column offsets reported by Location
* objects are 1-based, but... | [
"@",
"Override",
"protected",
"void",
"doInitInputLocation",
"(",
"WstxInputData",
"reader",
")",
"{",
"reader",
".",
"mCurrInputProcessed",
"=",
"mContentStart",
".",
"getCharacterOffset",
"(",
")",
";",
"reader",
".",
"mCurrInputRow",
"=",
"mContentStart",
".",
... | Unlike with reader source, we won't start from beginning of a file,
but usually from somewhere in the middle... | [
"Unlike",
"with",
"reader",
"source",
"we",
"won",
"t",
"start",
"from",
"beginning",
"of",
"a",
"file",
"but",
"usually",
"from",
"somewhere",
"in",
"the",
"middle",
"..."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/CharArraySource.java#L44-L54 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/UTF8Writer.java | UTF8Writer._convertSurrogate | private final int _convertSurrogate(int secondPart)
throws IOException
{
int firstPart = mSurrogate;
mSurrogate = 0;
// Ok, then, is the second part valid?
if (secondPart < SURR2_FIRST || secondPart > SURR2_LAST) {
throw new IOException("Broken surrogate pair: fi... | java | private final int _convertSurrogate(int secondPart)
throws IOException
{
int firstPart = mSurrogate;
mSurrogate = 0;
// Ok, then, is the second part valid?
if (secondPart < SURR2_FIRST || secondPart > SURR2_LAST) {
throw new IOException("Broken surrogate pair: fi... | [
"private",
"final",
"int",
"_convertSurrogate",
"(",
"int",
"secondPart",
")",
"throws",
"IOException",
"{",
"int",
"firstPart",
"=",
"mSurrogate",
";",
"mSurrogate",
"=",
"0",
";",
"// Ok, then, is the second part valid?",
"if",
"(",
"secondPart",
"<",
"SURR2_FIRST... | Method called to calculate UTF codepoint, from a surrogate pair. | [
"Method",
"called",
"to",
"calculate",
"UTF",
"codepoint",
"from",
"a",
"surrogate",
"pair",
"."
] | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/UTF8Writer.java#L394-L405 | train |
FasterXML/woodstox | src/main/java/com/ctc/wstx/evt/WstxEventReader.java | WstxEventReader.getErrorDesc | protected String getErrorDesc(int errorType, int currEvent)
{
// Defaults are mostly fine, except we can easily add event type desc
switch (errorType) {
case ERR_GETELEMTEXT_NOT_START_ELEM:
return ErrorConsts.ERR_STATE_NOT_STELEM+", got "+ErrorConsts.tokenTypeDesc(currEvent);
... | java | protected String getErrorDesc(int errorType, int currEvent)
{
// Defaults are mostly fine, except we can easily add event type desc
switch (errorType) {
case ERR_GETELEMTEXT_NOT_START_ELEM:
return ErrorConsts.ERR_STATE_NOT_STELEM+", got "+ErrorConsts.tokenTypeDesc(currEvent);
... | [
"protected",
"String",
"getErrorDesc",
"(",
"int",
"errorType",
",",
"int",
"currEvent",
")",
"{",
"// Defaults are mostly fine, except we can easily add event type desc",
"switch",
"(",
"errorType",
")",
"{",
"case",
"ERR_GETELEMTEXT_NOT_START_ELEM",
":",
"return",
"ErrorC... | Method called upon encountering a problem that should result
in an exception being thrown. If non-null String is returned.
that will be used as the message of exception thrown; if null,
a standard message will be used instead.
@param errorType Type of the problem, one of <code>ERR_</code>
constants
@param eventType Ty... | [
"Method",
"called",
"upon",
"encountering",
"a",
"problem",
"that",
"should",
"result",
"in",
"an",
"exception",
"being",
"thrown",
".",
"If",
"non",
"-",
"null",
"String",
"is",
"returned",
".",
"that",
"will",
"be",
"used",
"as",
"the",
"message",
"of",
... | ffcaabdc06672d9564c48c25d601d029b7fd6548 | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/evt/WstxEventReader.java#L173-L187 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.getLeapMonth | final int getLeapMonth(
int cycle,
int yearOfCycle
) {
int[] leapMonths = this.getLeapMonths();
int elapsedYears = (cycle - 1) * 60 + yearOfCycle - 1;
int index = 2 * ((elapsedYears - leapMonths[0]) / 3); // first lower bound estimation
int lm = 0;
while ((in... | java | final int getLeapMonth(
int cycle,
int yearOfCycle
) {
int[] leapMonths = this.getLeapMonths();
int elapsedYears = (cycle - 1) * 60 + yearOfCycle - 1;
int index = 2 * ((elapsedYears - leapMonths[0]) / 3); // first lower bound estimation
int lm = 0;
while ((in... | [
"final",
"int",
"getLeapMonth",
"(",
"int",
"cycle",
",",
"int",
"yearOfCycle",
")",
"{",
"int",
"[",
"]",
"leapMonths",
"=",
"this",
".",
"getLeapMonths",
"(",
")",
";",
"int",
"elapsedYears",
"=",
"(",
"cycle",
"-",
"1",
")",
"*",
"60",
"+",
"yearO... | number of leap month or zero if no leap year | [
"number",
"of",
"leap",
"month",
"or",
"zero",
"if",
"no",
"leap",
"year"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L132-L155 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.isValid | boolean isValid(
int cycle,
int yearOfCycle,
EastAsianMonth month,
int dayOfMonth
) {
if (
(cycle < 72) || (cycle > 94)
|| (yearOfCycle < 1) || (yearOfCycle > 60)
|| ((cycle == 72) && (yearOfCycle < 22))
|| ((cycle == 94) && (ye... | java | boolean isValid(
int cycle,
int yearOfCycle,
EastAsianMonth month,
int dayOfMonth
) {
if (
(cycle < 72) || (cycle > 94)
|| (yearOfCycle < 1) || (yearOfCycle > 60)
|| ((cycle == 72) && (yearOfCycle < 22))
|| ((cycle == 94) && (ye... | [
"boolean",
"isValid",
"(",
"int",
"cycle",
",",
"int",
"yearOfCycle",
",",
"EastAsianMonth",
"month",
",",
"int",
"dayOfMonth",
")",
"{",
"if",
"(",
"(",
"cycle",
"<",
"72",
")",
"||",
"(",
"cycle",
">",
"94",
")",
"||",
"(",
"yearOfCycle",
"<",
"1",... | true if valid else false | [
"true",
"if",
"valid",
"else",
"false"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L172-L195 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.hasNoMajorSolarTerm | final boolean hasNoMajorSolarTerm(long utcDays) {
double jd0 = JulianDay.ofEphemerisTime(this.midnight(utcDays)).getValue();
int index0 = (2 + (int) Math.floor(SolarTerm.solarLongitude(jd0) / 30)) % 12;
double jd1 = JulianDay.ofEphemerisTime(this.midnight(this.newMoonOnOrAfter(utcDays + 1))).get... | java | final boolean hasNoMajorSolarTerm(long utcDays) {
double jd0 = JulianDay.ofEphemerisTime(this.midnight(utcDays)).getValue();
int index0 = (2 + (int) Math.floor(SolarTerm.solarLongitude(jd0) / 30)) % 12;
double jd1 = JulianDay.ofEphemerisTime(this.midnight(this.newMoonOnOrAfter(utcDays + 1))).get... | [
"final",
"boolean",
"hasNoMajorSolarTerm",
"(",
"long",
"utcDays",
")",
"{",
"double",
"jd0",
"=",
"JulianDay",
".",
"ofEphemerisTime",
"(",
"this",
".",
"midnight",
"(",
"utcDays",
")",
")",
".",
"getValue",
"(",
")",
";",
"int",
"index0",
"=",
"(",
"2"... | leap months have no major solar terms | [
"leap",
"months",
"have",
"no",
"major",
"solar",
"terms"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L215-L221 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.newYearInSui | private long newYearInSui(long utcDays) {
long s1 = this.winterOnOrBefore(utcDays);
long s2 = this.winterOnOrBefore(s1 + 370);
long m12 = this.newMoonOnOrAfter(s1 + 1);
long m13 = this.newMoonOnOrAfter(m12 + 1);
long nextM11 = this.newMoonBefore(s2 + 1);
if ((lunations(m... | java | private long newYearInSui(long utcDays) {
long s1 = this.winterOnOrBefore(utcDays);
long s2 = this.winterOnOrBefore(s1 + 370);
long m12 = this.newMoonOnOrAfter(s1 + 1);
long m13 = this.newMoonOnOrAfter(m12 + 1);
long nextM11 = this.newMoonBefore(s2 + 1);
if ((lunations(m... | [
"private",
"long",
"newYearInSui",
"(",
"long",
"utcDays",
")",
"{",
"long",
"s1",
"=",
"this",
".",
"winterOnOrBefore",
"(",
"utcDays",
")",
";",
"long",
"s2",
"=",
"this",
".",
"winterOnOrBefore",
"(",
"s1",
"+",
"370",
")",
";",
"long",
"m12",
"=",
... | a sui is the period from one winter to next winter ensuring that winter solstice is always in 11th month | [
"a",
"sui",
"is",
"the",
"period",
"from",
"one",
"winter",
"to",
"next",
"winter",
"ensuring",
"that",
"winter",
"solstice",
"is",
"always",
"in",
"11th",
"month"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L246-L258 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.newYearOnOrBefore | private long newYearOnOrBefore(long utcDays) {
long ny = this.newYearInSui(utcDays);
if (utcDays >= ny) {
return ny;
} else {
return this.newYearInSui(utcDays - 180); // previous sui
}
} | java | private long newYearOnOrBefore(long utcDays) {
long ny = this.newYearInSui(utcDays);
if (utcDays >= ny) {
return ny;
} else {
return this.newYearInSui(utcDays - 180); // previous sui
}
} | [
"private",
"long",
"newYearOnOrBefore",
"(",
"long",
"utcDays",
")",
"{",
"long",
"ny",
"=",
"this",
".",
"newYearInSui",
"(",
"utcDays",
")",
";",
"if",
"(",
"utcDays",
">=",
"ny",
")",
"{",
"return",
"ny",
";",
"}",
"else",
"{",
"return",
"this",
"... | start of lunisolar year | [
"start",
"of",
"lunisolar",
"year"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L261-L268 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.hasLeapMonth | private boolean hasLeapMonth(long m0, long m) {
return (
(m >= m0)
&& (this.hasNoMajorSolarTerm(m) || this.hasLeapMonth(m0, this.newMoonBefore(m)))
);
} | java | private boolean hasLeapMonth(long m0, long m) {
return (
(m >= m0)
&& (this.hasNoMajorSolarTerm(m) || this.hasLeapMonth(m0, this.newMoonBefore(m)))
);
} | [
"private",
"boolean",
"hasLeapMonth",
"(",
"long",
"m0",
",",
"long",
"m",
")",
"{",
"return",
"(",
"(",
"m",
">=",
"m0",
")",
"&&",
"(",
"this",
".",
"hasNoMajorSolarTerm",
"(",
"m",
")",
"||",
"this",
".",
"hasLeapMonth",
"(",
"m0",
",",
"this",
... | is there any leap month between m0 and m? | [
"is",
"there",
"any",
"leap",
"month",
"between",
"m0",
"and",
"m?"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L271-L276 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/EastAsianCS.java | EastAsianCS.winterOnOrBefore | private long winterOnOrBefore(long utcDays) {
ZonalOffset offset = this.getOffset(utcDays);
PlainDate date = PlainDate.of(utcDays, EpochDays.UTC);
int year = (((date.getMonth() <= 11) || (date.getDayOfMonth() <= 15)) ? date.getYear() - 1 : date.getYear());
Moment winter = AstronomicalSea... | java | private long winterOnOrBefore(long utcDays) {
ZonalOffset offset = this.getOffset(utcDays);
PlainDate date = PlainDate.of(utcDays, EpochDays.UTC);
int year = (((date.getMonth() <= 11) || (date.getDayOfMonth() <= 15)) ? date.getYear() - 1 : date.getYear());
Moment winter = AstronomicalSea... | [
"private",
"long",
"winterOnOrBefore",
"(",
"long",
"utcDays",
")",
"{",
"ZonalOffset",
"offset",
"=",
"this",
".",
"getOffset",
"(",
"utcDays",
")",
";",
"PlainDate",
"date",
"=",
"PlainDate",
".",
"of",
"(",
"utcDays",
",",
"EpochDays",
".",
"UTC",
")",
... | search for winter solstice | [
"search",
"for",
"winter",
"solstice"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/EastAsianCS.java#L295-L306 | train |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/AstronomicalHijriData.java | AstronomicalHijriData.search | private static int search(
long utcDays,
long[] firstOfMonth
) {
int low = 0;
int high = firstOfMonth.length - 1;
while (low <= high) {
int middle = (low + high) / 2;
if (firstOfMonth[middle] <= utcDays) {
low = middle + 1;
... | java | private static int search(
long utcDays,
long[] firstOfMonth
) {
int low = 0;
int high = firstOfMonth.length - 1;
while (low <= high) {
int middle = (low + high) / 2;
if (firstOfMonth[middle] <= utcDays) {
low = middle + 1;
... | [
"private",
"static",
"int",
"search",
"(",
"long",
"utcDays",
",",
"long",
"[",
"]",
"firstOfMonth",
")",
"{",
"int",
"low",
"=",
"0",
";",
"int",
"high",
"=",
"firstOfMonth",
".",
"length",
"-",
"1",
";",
"while",
"(",
"low",
"<=",
"high",
")",
"{... | returns index of month-start associated with utcDays | [
"returns",
"index",
"of",
"month",
"-",
"start",
"associated",
"with",
"utcDays"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/AstronomicalHijriData.java#L311-L331 | train |
MenoData/Time4J | base/src/main/java/net/time4j/clock/SntpMessage.java | SntpMessage.decode | private static double decode(
byte[] data,
int pointer
) {
long ntp = 0L;
for (int i = 0; i < 8; i++) {
long unsigned = (data[i + pointer] & 0xFF);
ntp |= (unsigned << (56 - i * 8));
}
// Festkomma vor Bit 32, deshalb Bits nach rechts schieb... | java | private static double decode(
byte[] data,
int pointer
) {
long ntp = 0L;
for (int i = 0; i < 8; i++) {
long unsigned = (data[i + pointer] & 0xFF);
ntp |= (unsigned << (56 - i * 8));
}
// Festkomma vor Bit 32, deshalb Bits nach rechts schieb... | [
"private",
"static",
"double",
"decode",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"pointer",
")",
"{",
"long",
"ntp",
"=",
"0L",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"long",
"unsigned",
"=",
"... | NTP-Timestamp aus byte-Array dekodieren | [
"NTP",
"-",
"Timestamp",
"aus",
"byte",
"-",
"Array",
"dekodieren"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/clock/SntpMessage.java#L832-L852 | train |
MenoData/Time4J | base/src/main/java/net/time4j/clock/SntpMessage.java | SntpMessage.encode | private static void encode(
byte[] data,
int pointer,
double timestamp
) {
// UT1-Mikrosekunden konstruieren
long ut1 = convert(timestamp);
boolean before2036 = (ut1 + OFFSET_2036 < 0);
long micros;
if (before2036) {
micros = ut1 + OFFSET... | java | private static void encode(
byte[] data,
int pointer,
double timestamp
) {
// UT1-Mikrosekunden konstruieren
long ut1 = convert(timestamp);
boolean before2036 = (ut1 + OFFSET_2036 < 0);
long micros;
if (before2036) {
micros = ut1 + OFFSET... | [
"private",
"static",
"void",
"encode",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"pointer",
",",
"double",
"timestamp",
")",
"{",
"// UT1-Mikrosekunden konstruieren",
"long",
"ut1",
"=",
"convert",
"(",
"timestamp",
")",
";",
"boolean",
"before2036",
"=",
"... | NTP-Timestamp als byte-Array kodieren | [
"NTP",
"-",
"Timestamp",
"als",
"byte",
"-",
"Array",
"kodieren"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/clock/SntpMessage.java#L855-L893 | train |
MenoData/Time4J | base/src/main/java/net/time4j/range/SPX.java | SPX.readBoundary | private static Object readBoundary(
ObjectInput in,
byte header
) throws IOException, ClassNotFoundException {
int past = (header & 0x1);
if (past == 1) {
return Boundary.infinitePast();
}
int future = (header & 0x2);
if (future == 2) {
... | java | private static Object readBoundary(
ObjectInput in,
byte header
) throws IOException, ClassNotFoundException {
int past = (header & 0x1);
if (past == 1) {
return Boundary.infinitePast();
}
int future = (header & 0x2);
if (future == 2) {
... | [
"private",
"static",
"Object",
"readBoundary",
"(",
"ObjectInput",
"in",
",",
"byte",
"header",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"past",
"=",
"(",
"header",
"&",
"0x1",
")",
";",
"if",
"(",
"past",
"==",
"1",
")",
... | serialization of a single boundary object | [
"serialization",
"of",
"a",
"single",
"boundary",
"object"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/SPX.java#L521-L555 | train |
MenoData/Time4J | base/src/main/java/net/time4j/range/TimestampInterval.java | TimestampInterval.in | MomentInterval in(Timezone tz) {
Boundary<Moment> b1;
Boundary<Moment> b2;
if (this.getStart().isInfinite()) {
b1 = Boundary.infinitePast();
} else {
Moment m1 = this.getStart().getTemporal().in(tz);
b1 = Boundary.of(this.getStart().getEdge(), m1);
... | java | MomentInterval in(Timezone tz) {
Boundary<Moment> b1;
Boundary<Moment> b2;
if (this.getStart().isInfinite()) {
b1 = Boundary.infinitePast();
} else {
Moment m1 = this.getStart().getTemporal().in(tz);
b1 = Boundary.of(this.getStart().getEdge(), m1);
... | [
"MomentInterval",
"in",
"(",
"Timezone",
"tz",
")",
"{",
"Boundary",
"<",
"Moment",
">",
"b1",
";",
"Boundary",
"<",
"Moment",
">",
"b2",
";",
"if",
"(",
"this",
".",
"getStart",
"(",
")",
".",
"isInfinite",
"(",
")",
")",
"{",
"b1",
"=",
"Boundary... | combines this local timestamp interval with given timezone to a global UTC-interval | [
"combines",
"this",
"local",
"timestamp",
"interval",
"with",
"given",
"timezone",
"to",
"a",
"global",
"UTC",
"-",
"interval"
] | 08b2eda6b2dbb140b92011cf7071bb087edd46a5 | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/TimestampInterval.java#L1457-L1478 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.