code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 833
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public void writeAttrString(
Writer writer,
String string,
String encoding)
throws IOException
{
final int len = string.length();
if (len > m_attrBuff.length)
{
m_attrBuff = new char[len*2 + 1];
}
string.getChars(0,len, m_attrBuff, 0);
final char[] stringChars = m_attrBuff;
for (int i = 0; i < len; i++)
{
char ch = stringChars[i];
if (m_charInfo.shouldMapAttrChar(ch)) {
// The character is supposed to be replaced by a String
// e.g. '&' --> "&"
// e.g. '<' --> "<"
accumDefaultEscape(writer, ch, i, stringChars, len, false, true);
}
else {
if (0x0 <= ch && ch <= 0x1F) {
// Range 0x00 through 0x1F inclusive
// This covers the non-whitespace control characters
// in the range 0x1 to 0x1F inclusive.
// It also covers the whitespace control characters in the same way:
// 0x9 TAB
// 0xA NEW LINE
// 0xD CARRIAGE RETURN
//
// We also cover 0x0 ... It isn't valid
// but we will output "�"
// The default will handle this just fine, but this
// is a little performance boost to handle the more
// common TAB, NEW-LINE, CARRIAGE-RETURN
switch (ch) {
case CharInfo.S_HORIZONAL_TAB:
writer.write("	");
break;
case CharInfo.S_LINEFEED:
writer.write(" ");
break;
case CharInfo.S_CARRIAGERETURN:
writer.write(" ");
break;
default:
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
break;
}
}
else if (ch < 0x7F) {
// Range 0x20 through 0x7E inclusive
// Normal ASCII chars
writer.write(ch);
}
else if (ch <= 0x9F){
// Range 0x7F through 0x9F inclusive
// More control characters
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
}
else if (ch == CharInfo.S_LINE_SEPARATOR) {
// LINE SEPARATOR
writer.write("
");
}
else if (m_encodingInfo.isInEncoding(ch)) {
// If the character is in the encoding, and
// not in the normal ASCII range, we also
// just write it out
writer.write(ch);
}
else {
// This is a fallback plan, we should never get here
// but if the character wasn't previously handled
// (i.e. isn't in the encoding, etc.) then what
// should we do? We choose to write out a character ref
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
}
}
}
} |
Returns the specified <var>string</var> after substituting <VAR>specials</VAR>,
and UTF-16 surrogates for chracter references <CODE>&#xnn</CODE>.
@param string String to convert to XML format.
@param encoding CURRENTLY NOT IMPLEMENTED.
@throws java.io.IOException
| ToStream::writeAttrString | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void endElement(String namespaceURI, String localName, String name)
throws org.xml.sax.SAXException
{
if (m_inEntityRef)
return;
// namespaces declared at the current depth are no longer valid
// so get rid of them
m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null);
try
{
final java.io.Writer writer = m_writer;
if (m_elemContext.m_startTagOpen)
{
if (m_tracer != null)
super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
processAttributes(m_writer, nAttrs);
// clear attributes object for re-use with next element
m_attributes.clear();
}
if (m_spaceBeforeClose)
writer.write(" />");
else
writer.write("/>");
/* don't need to pop cdataSectionState because
* this element ended so quickly that we didn't get
* to push the state.
*/
}
else
{
if (m_cdataTagOpen)
closeCDATA();
if (shouldIndent())
indent(m_elemContext.m_currentElemDepth - 1);
writer.write('<');
writer.write('/');
writer.write(name);
writer.write('>');
}
}
catch (IOException e)
{
throw new SAXException(e);
}
if (!m_elemContext.m_startTagOpen && m_doIndent)
{
m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
}
m_isprevtext = false;
// fire off the end element event
if (m_tracer != null)
super.fireEndElem(name);
m_elemContext = m_elemContext.m_prev;
} |
Receive notification of the end of an element.
@param namespaceURI The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.
@param localName The local name (without prefix), or the
empty string if Namespace processing is not being
performed.
@param name The element type name
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception.
@throws org.xml.sax.SAXException
| ToStream::endElement | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void endElement(String name) throws org.xml.sax.SAXException
{
endElement(null, null, name);
} |
Receive notification of the end of an element.
@param name The element type name
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception.
| ToStream::endElement | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void startPrefixMapping(String prefix, String uri)
throws org.xml.sax.SAXException
{
// the "true" causes the flush of any open tags
startPrefixMapping(prefix, uri, true);
} |
Begin the scope of a prefix-URI Namespace mapping
just before another element is about to start.
This call will close any open tags so that the prefix mapping
will not apply to the current element, but the up comming child.
@see org.xml.sax.ContentHandler#startPrefixMapping
@param prefix The Namespace prefix being declared.
@param uri The Namespace URI the prefix is mapped to.
@throws org.xml.sax.SAXException The client may throw
an exception during processing.
| ToStream::startPrefixMapping | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public boolean startPrefixMapping(
String prefix,
String uri,
boolean shouldFlush)
throws org.xml.sax.SAXException
{
/* Remember the mapping, and at what depth it was declared
* This is one greater than the current depth because these
* mappings will apply to the next depth. This is in
* consideration that startElement() will soon be called
*/
boolean pushed;
int pushDepth;
if (shouldFlush)
{
flushPending();
// the prefix mapping applies to the child element (one deeper)
pushDepth = m_elemContext.m_currentElemDepth + 1;
}
else
{
// the prefix mapping applies to the current element
pushDepth = m_elemContext.m_currentElemDepth;
}
pushed = m_prefixMap.pushNamespace(prefix, uri, pushDepth);
if (pushed)
{
/* Brian M.: don't know if we really needto do this. The
* callers of this object should have injected both
* startPrefixMapping and the attributes. We are
* just covering our butt here.
*/
String name;
if (EMPTYSTRING.equals(prefix))
{
name = "xmlns";
addAttributeAlways(XMLNS_URI, name, name, "CDATA", uri, false);
}
else
{
if (!EMPTYSTRING.equals(uri))
// hack for XSLTC attribset16 test
{ // that maps ns1 prefix to "" URI
name = "xmlns:" + prefix;
/* for something like xmlns:abc="w3.pretend.org"
* the uri is the value, that is why we pass it in the
* value, or 5th slot of addAttributeAlways()
*/
addAttributeAlways(XMLNS_URI, prefix, name, "CDATA", uri, false);
}
}
}
return pushed;
} |
Handle a prefix/uri mapping, which is associated with a startElement()
that is soon to follow. Need to close any open start tag to make
sure than any name space attributes due to this event are associated wih
the up comming element, not the current one.
@see ExtendedContentHandler#startPrefixMapping
@param prefix The Namespace prefix being declared.
@param uri The Namespace URI the prefix is mapped to.
@param shouldFlush true if any open tags need to be closed first, this
will impact which element the mapping applies to (open parent, or its up
comming child)
@return returns true if the call made a change to the current
namespace information, false if it did not change anything, e.g. if the
prefix/namespace mapping was already in scope from before.
@throws org.xml.sax.SAXException The client may throw
an exception during processing.
| ToStream::startPrefixMapping | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void comment(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
int start_old = start;
if (m_inEntityRef)
return;
if (m_elemContext.m_startTagOpen)
{
closeStartTag();
m_elemContext.m_startTagOpen = false;
}
else if (m_needToCallStartDocument)
{
startDocumentInternal();
m_needToCallStartDocument = false;
}
try
{
final int limit = start + length;
boolean wasDash = false;
if (m_cdataTagOpen)
closeCDATA();
if (shouldIndent())
indent();
final java.io.Writer writer = m_writer;
writer.write(COMMENT_BEGIN);
// Detect occurrences of two consecutive dashes, handle as necessary.
for (int i = start; i < limit; i++)
{
if (wasDash && ch[i] == '-')
{
writer.write(ch, start, i - start);
writer.write(" -");
start = i + 1;
}
wasDash = (ch[i] == '-');
}
// if we have some chars in the comment
if (length > 0)
{
// Output the remaining characters (if any)
final int remainingChars = (limit - start);
if (remainingChars > 0)
writer.write(ch, start, remainingChars);
// Protect comment end from a single trailing dash
if (ch[limit - 1] == '-')
writer.write(' ');
}
writer.write(COMMENT_END);
}
catch (IOException e)
{
throw new SAXException(e);
}
/*
* Don't write out any indentation whitespace now,
* because there may be non-whitespace text after this.
*
* Simply mark that at this point if we do decide
* to indent that we should
* add a newline on the end of the current line before
* the indentation at the start of the next line.
*/
m_startNewLine = true;
// time to generate comment event
if (m_tracer != null)
super.fireCommentEvent(ch, start_old,length);
} |
Receive notification of an XML comment anywhere in the document. This
callback will be used for comments inside or outside the document
element, including comments in the external DTD subset (if read).
@param ch An array holding the characters in the comment.
@param start The starting position in the array.
@param length The number of characters to use from the array.
@throws org.xml.sax.SAXException The application may raise an exception.
| ToStream::comment | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void endCDATA() throws org.xml.sax.SAXException
{
if (m_cdataTagOpen)
closeCDATA();
m_cdataStartCalled = false;
} |
Report the end of a CDATA section.
@throws org.xml.sax.SAXException The application may raise an exception.
@see #startCDATA
| ToStream::endCDATA | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void endDTD() throws org.xml.sax.SAXException
{
try
{
if (m_needToOutputDocTypeDecl)
{
outputDocTypeDecl(m_elemContext.m_elementName, false);
m_needToOutputDocTypeDecl = false;
}
final java.io.Writer writer = m_writer;
if (!m_inDoctype)
writer.write("]>");
else
{
writer.write('>');
}
writer.write(m_lineSep, 0, m_lineSepLen);
}
catch (IOException e)
{
throw new SAXException(e);
}
} |
Report the end of DTD declarations.
@throws org.xml.sax.SAXException The application may raise an exception.
@see #startDTD
| ToStream::endDTD | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException
{ // do nothing
} |
End the scope of a prefix-URI Namespace mapping.
@see org.xml.sax.ContentHandler#endPrefixMapping
@param prefix The prefix that was being mapping.
@throws org.xml.sax.SAXException The client may throw
an exception during processing.
| ToStream::endPrefixMapping | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void ignorableWhitespace(char ch[], int start, int length)
throws org.xml.sax.SAXException
{
if (0 == length)
return;
characters(ch, start, length);
} |
Receive notification of ignorable whitespace in element content.
Not sure how to get this invoked quite yet.
@param ch The characters from the XML document.
@param start The start position in the array.
@param length The number of characters to read from the array.
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception.
@see #characters
@throws org.xml.sax.SAXException
| ToStream::ignorableWhitespace | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void skippedEntity(String name) throws org.xml.sax.SAXException
{ // TODO: Should handle
} |
Receive notification of a skipped entity.
@see org.xml.sax.ContentHandler#skippedEntity
@param name The name of the skipped entity. If it is a
parameter entity, the name will begin with '%',
and if it is the external DTD subset, it will be the string
"[dtd]".
@throws org.xml.sax.SAXException Any SAX exception, possibly wrapping
another exception.
| ToStream::skippedEntity | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void startCDATA() throws org.xml.sax.SAXException
{
m_cdataStartCalled = true;
} |
Report the start of a CDATA section.
@throws org.xml.sax.SAXException The application may raise an exception.
@see #endCDATA
| ToStream::startCDATA | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void startEntity(String name) throws org.xml.sax.SAXException
{
if (name.equals("[dtd]"))
m_inExternalDTD = true;
if (!m_expandDTDEntities && !m_inExternalDTD) {
/* Only leave the entity as-is if
* we've been told not to expand them
* and this is not the magic [dtd] name.
*/
startNonEscaping();
characters("&" + name + ';');
endNonEscaping();
}
m_inEntityRef = true;
} |
Report the beginning of an entity.
The start and end of the document entity are not reported.
The start and end of the external DTD subset are reported
using the pseudo-name "[dtd]". All other events must be
properly nested within start/end entity events.
@param name The name of the entity. If it is a parameter
entity, the name will begin with '%'.
@throws org.xml.sax.SAXException The application may raise an exception.
@see #endEntity
@see org.xml.sax.ext.DeclHandler#internalEntityDecl
@see org.xml.sax.ext.DeclHandler#externalEntityDecl
| ToStream::startEntity | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
protected void closeStartTag() throws SAXException
{
if (m_elemContext.m_startTagOpen)
{
try
{
if (m_tracer != null)
super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
processAttributes(m_writer, nAttrs);
// clear attributes object for re-use with next element
m_attributes.clear();
}
m_writer.write('>');
}
catch (IOException e)
{
throw new SAXException(e);
}
/* whether Xalan or XSLTC, we have the prefix mappings now, so
* lets determine if the current element is specified in the cdata-
* section-elements list.
*/
if (m_CdataElems != null)
m_elemContext.m_isCdataSection = isCdataSection();
if (m_doIndent)
{
m_isprevtext = false;
m_preserves.push(m_ispreserve);
}
}
} |
For the enclosing elements starting tag write out
out any attributes followed by ">"
@throws org.xml.sax.SAXException
| ToStream::closeStartTag | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void startDTD(String name, String publicId, String systemId)
throws org.xml.sax.SAXException
{
setDoctypeSystem(systemId);
setDoctypePublic(publicId);
m_elemContext.m_elementName = name;
m_inDoctype = true;
} |
Report the start of DTD declarations, if any.
Any declarations are assumed to be in the internal subset unless
otherwise indicated.
@param name The document type name.
@param publicId The declared public identifier for the
external DTD subset, or null if none was declared.
@param systemId The declared system identifier for the
external DTD subset, or null if none was declared.
@throws org.xml.sax.SAXException The application may raise an
exception.
@see #endDTD
@see #startEntity
| ToStream::startDTD | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public int getIndentAmount()
{
return m_indentAmount;
} |
Returns the m_indentAmount.
@return int
| ToStream::getIndentAmount | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void setIndentAmount(int m_indentAmount)
{
this.m_indentAmount = m_indentAmount;
} |
Sets the m_indentAmount.
@param m_indentAmount The m_indentAmount to set
| ToStream::setIndentAmount | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
protected boolean shouldIndent()
{
return m_doIndent && (!m_ispreserve && !m_isprevtext) && m_elemContext.m_currentElemDepth > 0;
} |
Tell if, based on space preservation constraints and the doIndent property,
if an indent should occur.
@return True if an indent should occur.
| ToStream::shouldIndent | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
private void setCdataSectionElements(String key, Properties props)
{
String s = props.getProperty(key);
if (null != s)
{
// Vector of URI/LocalName pairs
Vector v = new Vector();
int l = s.length();
boolean inCurly = false;
StringBuffer buf = new StringBuffer();
// parse through string, breaking on whitespaces. I do this instead
// of a tokenizer so I can track whitespace inside of curly brackets,
// which theoretically shouldn't happen if they contain legal URLs.
for (int i = 0; i < l; i++)
{
char c = s.charAt(i);
if (Character.isWhitespace(c))
{
if (!inCurly)
{
if (buf.length() > 0)
{
addCdataSectionElement(buf.toString(), v);
buf.setLength(0);
}
continue;
}
}
else if ('{' == c)
inCurly = true;
else if ('}' == c)
inCurly = false;
buf.append(c);
}
if (buf.length() > 0)
{
addCdataSectionElement(buf.toString(), v);
buf.setLength(0);
}
// call the official, public method to set the collected names
setCdataSectionElements(v);
}
} |
Searches for the list of qname properties with the specified key in the
property list. If the key is not found in this property list, the default
property list, and its defaults, recursively, are then checked. The
method returns <code>null</code> if the property is not found.
@param key the property key.
@param props the list of properties to search in.
Sets the vector of local-name/URI pairs of the cdata section elements
specified in the cdata-section-elements property.
This method is essentially a copy of getQNameProperties() from
OutputProperties. Eventually this method should go away and a call
to setCdataSectionElements(Vector v) should be made directly.
| ToStream::setCdataSectionElements | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
private void addCdataSectionElement(String URI_and_localName, Vector v)
{
StringTokenizer tokenizer =
new StringTokenizer(URI_and_localName, "{}", false);
String s1 = tokenizer.nextToken();
String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
if (null == s2)
{
// add null URI and the local name
v.addElement(null);
v.addElement(s1);
}
else
{
// add URI, then local name
v.addElement(s1);
v.addElement(s2);
}
} |
Adds a URI/LocalName pair of strings to the list.
@param URI_and_localName String of the form "{uri}local" or "local"
@return a QName object
| ToStream::addCdataSectionElement | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void setCdataSectionElements(Vector URI_and_localNames)
{
// convert to the new way.
if (URI_and_localNames != null)
{
final int len = URI_and_localNames.size() - 1;
if (len > 0)
{
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 2)
{
// whitspace separated "{uri1}local1 {uri2}local2 ..."
if (i != 0)
sb.append(' ');
final String uri = (String) URI_and_localNames.elementAt(i);
final String localName =
(String) URI_and_localNames.elementAt(i + 1);
if (uri != null)
{
// If there is no URI don't put this in, just the localName then.
sb.append('{');
sb.append(uri);
sb.append('}');
}
sb.append(localName);
}
m_StringOfCDATASections = sb.toString();
}
}
initCdataElems(m_StringOfCDATASections);
} |
Remembers the cdata sections specified in the cdata-section-elements.
The "official way to set URI and localName pairs.
This method should be used by both Xalan and XSLTC.
@param URI_and_localNames a vector of pairs of Strings (URI/local)
| ToStream::setCdataSectionElements | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
protected String ensureAttributesNamespaceIsDeclared(
String ns,
String localName,
String rawName)
throws org.xml.sax.SAXException
{
if (ns != null && ns.length() > 0)
{
// extract the prefix in front of the raw name
int index = 0;
String prefixFromRawName =
(index = rawName.indexOf(":")) < 0
? ""
: rawName.substring(0, index);
if (index > 0)
{
// we have a prefix, lets see if it maps to a namespace
String uri = m_prefixMap.lookupNamespace(prefixFromRawName);
if (uri != null && uri.equals(ns))
{
// the prefix in the raw name is already maps to the given namespace uri
// so we don't need to do anything
return null;
}
else
{
// The uri does not map to the prefix in the raw name,
// so lets make the mapping.
this.startPrefixMapping(prefixFromRawName, ns, false);
this.addAttribute(
"http://www.w3.org/2000/xmlns/",
prefixFromRawName,
"xmlns:" + prefixFromRawName,
"CDATA",
ns, false);
return prefixFromRawName;
}
}
else
{
// we don't have a prefix in the raw name.
// Does the URI map to a prefix already?
String prefix = m_prefixMap.lookupPrefix(ns);
if (prefix == null)
{
// uri is not associated with a prefix,
// so lets generate a new prefix to use
prefix = m_prefixMap.generateNextPrefix();
this.startPrefixMapping(prefix, ns, false);
this.addAttribute(
"http://www.w3.org/2000/xmlns/",
prefix,
"xmlns:" + prefix,
"CDATA",
ns, false);
}
return prefix;
}
}
return null;
} |
Makes sure that the namespace URI for the given qualified attribute name
is declared.
@param ns the namespace URI
@param rawName the qualified name
@return returns null if no action is taken, otherwise it returns the
prefix used in declaring the namespace.
@throws SAXException
| ToStream::ensureAttributesNamespaceIsDeclared | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void flushPending() throws SAXException
{
if (m_needToCallStartDocument)
{
startDocumentInternal();
m_needToCallStartDocument = false;
}
if (m_elemContext.m_startTagOpen)
{
closeStartTag();
m_elemContext.m_startTagOpen = false;
}
if (m_cdataTagOpen)
{
closeCDATA();
m_cdataTagOpen = false;
}
if (m_writer != null) {
try {
m_writer.flush();
}
catch(IOException e) {
// what? me worry?
}
}
} |
This method flushes any pending events, which can be startDocument()
closing the opening tag of an element, or closing an open CDATA section.
| ToStream::flushPending | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public boolean addAttributeAlways(
String uri,
String localName,
String rawName,
String type,
String value,
boolean xslAttribute)
{
boolean was_added;
int index;
if (uri == null || localName == null || uri.length() == 0)
index = m_attributes.getIndex(rawName);
else {
index = m_attributes.getIndex(uri, localName);
}
if (index >= 0)
{
String old_value = null;
if (m_tracer != null)
{
old_value = m_attributes.getValue(index);
if (value.equals(old_value))
old_value = null;
}
/* We've seen the attribute before.
* We may have a null uri or localName, but all we really
* want to re-set is the value anyway.
*/
m_attributes.setValue(index, value);
was_added = false;
if (old_value != null)
firePseudoAttributes();
}
else
{
// the attribute doesn't exist yet, create it
if (xslAttribute)
{
/*
* This attribute is from an xsl:attribute element so we take some care in
* adding it, e.g.
* <elem1 foo:attr1="1" xmlns:foo="uri1">
* <xsl:attribute name="foo:attr2">2</xsl:attribute>
* </elem1>
*
* We are adding attr1 and attr2 both as attributes of elem1,
* and this code is adding attr2 (the xsl:attribute ).
* We could have a collision with the prefix like in the example above.
*/
// In the example above, is there a prefix like foo ?
final int colonIndex = rawName.indexOf(':');
if (colonIndex > 0)
{
String prefix = rawName.substring(0,colonIndex);
NamespaceMappings.MappingRecord existing_mapping = m_prefixMap.getMappingFromPrefix(prefix);
/* Before adding this attribute (foo:attr2),
* is the prefix for it (foo) already mapped at the current depth?
*/
if (existing_mapping != null
&& existing_mapping.m_declarationDepth == m_elemContext.m_currentElemDepth
&& !existing_mapping.m_uri.equals(uri))
{
/*
* There is an existing mapping of this prefix,
* it differs from the one we need,
* and unfortunately it is at the current depth so we
* can not over-ride it.
*/
/*
* Are we lucky enough that an existing other prefix maps to this URI ?
*/
prefix = m_prefixMap.lookupPrefix(uri);
if (prefix == null)
{
/* Unfortunately there is no existing prefix that happens to map to ours,
* so to avoid a prefix collision we must generated a new prefix to use.
* This is OK because the prefix URI mapping
* defined in the xsl:attribute is short in scope,
* just the xsl:attribute element itself,
* and at this point in serialization the body of the
* xsl:attribute, if any, is just a String. Right?
* . . . I sure hope so - Brian M.
*/
prefix = m_prefixMap.generateNextPrefix();
}
rawName = prefix + ':' + localName;
}
}
try
{
/* This is our last chance to make sure the namespace for this
* attribute is declared, especially if we just generated an alternate
* prefix to avoid a collision (the new prefix/rawName will go out of scope
* soon and be lost ... last chance here.
*/
String prefixUsed =
ensureAttributesNamespaceIsDeclared(
uri,
localName,
rawName);
}
catch (SAXException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
m_attributes.addAttribute(uri, localName, rawName, type, value);
was_added = true;
if (m_tracer != null)
firePseudoAttributes();
}
return was_added;
} |
Adds the given attribute to the set of attributes, even if there is
no currently open element. This is useful if a SAX startPrefixMapping()
should need to add an attribute before the element name is seen.
This method is a copy of its super classes method, except that some
tracing of events is done. This is so the tracing is only done for
stream serializers, not for SAX ones.
@param uri the URI of the attribute
@param localName the local name of the attribute
@param rawName the qualified name of the attribute
@param type the type of the attribute (probably CDATA)
@param value the value of the attribute
@param xslAttribute true if this attribute is coming from an xsl:attribute element.
@return true if the attribute value was added,
false if the attribute already existed and the value was
replaced with the new value.
| ToStream::addAttributeAlways | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
WritertoStringBuffer(StringBuffer sb)
{
m_stringbuf = sb;
} |
@see java.io.Writer#write(char[], int, int)
| WritertoStringBuffer::WritertoStringBuffer | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void flush() throws IOException
{
} |
@see java.io.Writer#flush()
| WritertoStringBuffer::flush | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void close() throws IOException
{
} |
@see java.io.Writer#close()
| WritertoStringBuffer::close | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void setTransformer(Transformer transformer) {
super.setTransformer(transformer);
if (m_tracer != null
&& !(m_writer instanceof SerializerTraceWriter) )
setWriterInternal(new SerializerTraceWriter(m_writer, m_tracer), false);
} |
@see SerializationHandler#setTransformer(Transformer)
| WritertoStringBuffer::setTransformer | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public boolean reset()
{
boolean wasReset = false;
if (super.reset())
{
resetToStream();
wasReset = true;
}
return wasReset;
} |
Try's to reset the super class and reset this class for
re-use, so that you don't need to create a new serializer
(mostly for performance reasons).
@return true if the class was successfuly reset.
| WritertoStringBuffer::reset | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
private void resetToStream()
{
this.m_cdataStartCalled = false;
/* The stream is being reset. It is one of
* ToXMLStream, ToHTMLStream ... and this type can't be changed
* so neither should m_charInfo which is associated with the
* type of Stream. Just leave m_charInfo as-is for the next re-use.
*
*/
// this.m_charInfo = null; // don't set to null
this.m_disableOutputEscapingStates.clear();
// this.m_encodingInfo = null; // don't set to null
this.m_escaping = true;
// Leave m_format alone for now - Brian M.
// this.m_format = null;
this.m_expandDTDEntities = true;
this.m_inDoctype = false;
this.m_ispreserve = false;
this.m_isprevtext = false;
this.m_isUTF8 = false; // ?? used anywhere ??
this.m_lineSep = s_systemLineSep;
this.m_lineSepLen = s_systemLineSep.length;
this.m_lineSepUse = true;
// this.m_outputStream = null; // Don't reset it may be re-used
this.m_preserves.clear();
this.m_shouldFlush = true;
this.m_spaceBeforeClose = false;
this.m_startNewLine = false;
this.m_writer_set_by_user = false;
} |
Reset all of the fields owned by ToStream class
| WritertoStringBuffer::resetToStream | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void setEncoding(String encoding)
{
setOutputProperty(OutputKeys.ENCODING,encoding);
} |
Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
@param encoding the character encoding
| WritertoStringBuffer::setEncoding | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public BoolStack()
{
this(32);
} |
Default constructor. Note that the default
block size is very small, for small lists.
| BoolStack::BoolStack | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public BoolStack(int size)
{
m_allocatedSize = size;
m_values = new boolean[size];
m_index = -1;
} |
Construct a IntVector, using the given block size.
@param size array size to allocate
| BoolStack::BoolStack | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final int size()
{
return m_index + 1;
} |
Get the length of the list.
@return Current length of the list
| BoolStack::size | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final void clear()
{
m_index = -1;
} |
Clears the stack.
| BoolStack::clear | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final boolean push(boolean val)
{
if (m_index == m_allocatedSize - 1)
grow();
return (m_values[++m_index] = val);
} |
Pushes an item onto the top of this stack.
@param val the boolean to be pushed onto this stack.
@return the <code>item</code> argument.
| BoolStack::push | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final boolean pop()
{
return m_values[m_index--];
} |
Removes the object at the top of this stack and returns that
object as the value of this function.
@return The object at the top of this stack.
@throws EmptyStackException if this stack is empty.
| BoolStack::pop | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final boolean popAndTop()
{
m_index--;
return (m_index >= 0) ? m_values[m_index] : false;
} |
Removes the object at the top of this stack and returns the
next object at the top as the value of this function.
@return Next object to the top or false if none there
| BoolStack::popAndTop | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final void setTop(boolean b)
{
m_values[m_index] = b;
} |
Set the item at the top of this stack
@param b Object to set at the top of this stack
| BoolStack::setTop | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final boolean peek()
{
return m_values[m_index];
} |
Looks at the object at the top of this stack without removing it
from the stack.
@return the object at the top of this stack.
@throws EmptyStackException if this stack is empty.
| BoolStack::peek | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final boolean peekOrFalse()
{
return (m_index > -1) ? m_values[m_index] : false;
} |
Looks at the object at the top of this stack without removing it
from the stack. If the stack is empty, it returns false.
@return the object at the top of this stack.
| BoolStack::peekOrFalse | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public final boolean peekOrTrue()
{
return (m_index > -1) ? m_values[m_index] : true;
} |
Looks at the object at the top of this stack without removing it
from the stack. If the stack is empty, it returns true.
@return the object at the top of this stack.
| BoolStack::peekOrTrue | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public boolean isEmpty()
{
return (m_index == -1);
} |
Tests if this stack is empty.
@return <code>true</code> if this stack is empty;
<code>false</code> otherwise.
| BoolStack::isEmpty | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
private void grow()
{
m_allocatedSize *= 2;
boolean newVector[] = new boolean[m_allocatedSize];
System.arraycopy(m_values, 0, newVector, 0, m_index + 1);
m_values = newVector;
} |
Grows the size of the stack
| BoolStack::grow | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void notationDecl(String name, String pubID, String sysID) throws SAXException {
// TODO Auto-generated method stub
try {
DTDprolog();
m_writer.write("<!NOTATION ");
m_writer.write(name);
if (pubID != null) {
m_writer.write(" PUBLIC \"");
m_writer.write(pubID);
}
else {
m_writer.write(" SYSTEM \"");
m_writer.write(sysID);
}
m_writer.write("\" >");
m_writer.write(m_lineSep, 0, m_lineSepLen);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
If this method is called, the serializer is used as a
DTDHandler, which changes behavior how the serializer
handles document entities.
@see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String)
| BoolStack::notationDecl | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void unparsedEntityDecl(String name, String pubID, String sysID, String notationName) throws SAXException {
// TODO Auto-generated method stub
try {
DTDprolog();
m_writer.write("<!ENTITY ");
m_writer.write(name);
if (pubID != null) {
m_writer.write(" PUBLIC \"");
m_writer.write(pubID);
}
else {
m_writer.write(" SYSTEM \"");
m_writer.write(sysID);
}
m_writer.write("\" NDATA ");
m_writer.write(notationName);
m_writer.write(" >");
m_writer.write(m_lineSep, 0, m_lineSepLen);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
If this method is called, the serializer is used as a
DTDHandler, which changes behavior how the serializer
handles document entities.
@see org.xml.sax.DTDHandler#unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
| BoolStack::unparsedEntityDecl | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
private void DTDprolog() throws SAXException, IOException {
final java.io.Writer writer = m_writer;
if (m_needToOutputDocTypeDecl)
{
outputDocTypeDecl(m_elemContext.m_elementName, false);
m_needToOutputDocTypeDecl = false;
}
if (m_inDoctype)
{
writer.write(" [");
writer.write(m_lineSep, 0, m_lineSepLen);
m_inDoctype = false;
}
} |
A private helper method to output the
@throws SAXException
@throws IOException
| BoolStack::DTDprolog | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void setDTDEntityExpansion(boolean expand) {
m_expandDTDEntities = expand;
} |
If set to false the serializer does not expand DTD entities,
but leaves them as is, the default value is true;
| BoolStack::setDTDEntityExpansion | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void setNewLine (char[] eolChars) {
m_lineSep = eolChars;
m_lineSepLen = eolChars.length;
} |
Sets the end of line characters to be used during serialization
@param eolChars A character array corresponding to the characters to be used.
| BoolStack::setNewLine | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public void addCdataSectionElements(String URI_and_localNames)
{
if (URI_and_localNames != null)
initCdataElems(URI_and_localNames);
if (m_StringOfCDATASections == null)
m_StringOfCDATASections = URI_and_localNames;
else
m_StringOfCDATASections += (" " + URI_and_localNames);
} |
Remembers the cdata sections specified in the cdata-section-elements by appending the given
cdata section elements to the list. This method can be called multiple times, but once an
element is put in the list of cdata section elements it can not be removed.
This method should be used by both Xalan and XSLTC.
@param URI_and_localNames a whitespace separated list of element names, each element
is a URI in curly braces (optional) and a local name. An example of such a parameter is:
"{http://company.com}price {myURI2}book chapter"
| BoolStack::addCdataSectionElements | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/ToStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/ToStream.java | MIT |
public StatsDimensionsValue(Parcel in) {
mInner = StatsDimensionsValueParcel.CREATOR.createFromParcel(in);
} |
Creates a {@code StatsDimensionValue} from a parcel.
@hide
| StatsDimensionsValue::StatsDimensionsValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public StatsDimensionsValue(StatsDimensionsValueParcel parcel) {
mInner = parcel;
} |
Creates a {@code StatsDimensionsValue} from a StatsDimensionsValueParcel
@hide
| StatsDimensionsValue::StatsDimensionsValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public int getField() {
return mInner.field;
} |
Return the field, i.e. the tag of a statsd atom.
@return the field
| StatsDimensionsValue::getField | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public String getStringValue() {
if (mInner.valueType == STRING_VALUE_TYPE) {
return mInner.stringValue;
} else {
Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not string.");
return null;
}
} |
Retrieve the String held, if any.
@return the {@link String} held if {@link #getValueType()} == {@link #STRING_VALUE_TYPE},
null otherwise
| StatsDimensionsValue::getStringValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public int getIntValue() {
if (mInner.valueType == INT_VALUE_TYPE) {
return mInner.intValue;
} else {
Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not int.");
return 0;
}
} |
Retrieve the int held, if any.
@return the int held if {@link #getValueType()} == {@link #INT_VALUE_TYPE}, 0 otherwise
| StatsDimensionsValue::getIntValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public long getLongValue() {
if (mInner.valueType == LONG_VALUE_TYPE) {
return mInner.longValue;
} else {
Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not long.");
return 0;
}
} |
Retrieve the long held, if any.
@return the long held if {@link #getValueType()} == {@link #LONG_VALUE_TYPE}, 0 otherwise
| StatsDimensionsValue::getLongValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public boolean getBooleanValue() {
if (mInner.valueType == BOOLEAN_VALUE_TYPE) {
return mInner.boolValue;
} else {
Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not boolean.");
return false;
}
} |
Retrieve the boolean held, if any.
@return the boolean held if {@link #getValueType()} == {@link #BOOLEAN_VALUE_TYPE},
false otherwise
| StatsDimensionsValue::getBooleanValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public float getFloatValue() {
if (mInner.valueType == FLOAT_VALUE_TYPE) {
return mInner.floatValue;
} else {
Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not float.");
return 0;
}
} |
Retrieve the float held, if any.
@return the float held if {@link #getValueType()} == {@link #FLOAT_VALUE_TYPE}, 0 otherwise
| StatsDimensionsValue::getFloatValue | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public List<StatsDimensionsValue> getTupleValueList() {
if (mInner.valueType == TUPLE_VALUE_TYPE) {
int length = (mInner.tupleValue == null) ? 0 : mInner.tupleValue.length;
List<StatsDimensionsValue> tupleValues = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
tupleValues.add(new StatsDimensionsValue(mInner.tupleValue[i]));
}
return tupleValues;
} else {
Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not tuple.");
return null;
}
} |
Retrieve the tuple, in the form of a {@link List} of {@link StatsDimensionsValue}, held,
if any.
@return the {@link List} of {@link StatsDimensionsValue} held
if {@link #getValueType()} == {@link #TUPLE_VALUE_TYPE},
null otherwise
| StatsDimensionsValue::getTupleValueList | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public int getValueType() {
return mInner.valueType;
} |
Returns the constant representing the type of value stored, namely one of
<ul>
<li>{@link #STRING_VALUE_TYPE}</li>
<li>{@link #INT_VALUE_TYPE}</li>
<li>{@link #LONG_VALUE_TYPE}</li>
<li>{@link #BOOLEAN_VALUE_TYPE}</li>
<li>{@link #FLOAT_VALUE_TYPE}</li>
<li>{@link #TUPLE_VALUE_TYPE}</li>
</ul>
@return the constant representing the type of value stored
| StatsDimensionsValue::getValueType | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public boolean isValueType(int valueType) {
return mInner.valueType == valueType;
} |
Returns whether the type of value stored is equal to the given type.
@param valueType int representing the type of value stored, as used in {@link #getValueType}
@return true if {@link #getValueType()} is equal to {@code valueType}.
| StatsDimensionsValue::isValueType | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
private String getValueTypeAsString() {
switch (mInner.valueType) {
case STRING_VALUE_TYPE:
return "string";
case INT_VALUE_TYPE:
return "int";
case LONG_VALUE_TYPE:
return "long";
case BOOLEAN_VALUE_TYPE:
return "boolean";
case FLOAT_VALUE_TYPE:
return "float";
case TUPLE_VALUE_TYPE:
return "tuple";
default:
return "unknown";
}
} |
Returns a string representation of the type of value stored.
| StatsDimensionsValue::getValueTypeAsString | java | Reginer/aosp-android-jar | android-34/src/android/os/StatsDimensionsValue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/os/StatsDimensionsValue.java | MIT |
public RSTextureView(Context context) {
super(context);
init();
//Log.v(RenderScript.LOG_TAG, "RSSurfaceView");
} |
@deprecated in API 16
Standard View constructor. In order to render something, you
must call {@link android.opengl.GLSurfaceView#setRenderer} to
register a renderer.
| RSTextureView::RSTextureView | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
public void pause() {
if(mRS != null) {
mRS.pause();
}
} |
@deprecated in API 16
Inform the view that the activity is paused. The owner of this view must
call this method when the activity is paused. Calling this method will
pause the rendering thread.
Must not be called before a renderer has been set.
| RSTextureView::pause | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
public void resume() {
if(mRS != null) {
mRS.resume();
}
} |
@deprecated in API 16
Inform the view that the activity is resumed. The owner of this view must
call this method when the activity is resumed. Calling this method will
recreate the OpenGL display and resume the rendering
thread.
Must not be called before a renderer has been set.
| RSTextureView::resume | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
public RenderScriptGL createRenderScriptGL(RenderScriptGL.SurfaceConfig sc) {
RenderScriptGL rs = new RenderScriptGL(this.getContext(), sc);
setRenderScriptGL(rs);
if (mSurfaceTexture != null) {
mRS.setSurfaceTexture(mSurfaceTexture, getWidth(), getHeight());
}
return rs;
} |
@deprecated in API 16
Create a new RenderScriptGL object and attach it to the
TextureView if present.
@param sc The RS surface config to create.
@return RenderScriptGL The new object created.
| RSTextureView::createRenderScriptGL | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
public void destroyRenderScriptGL() {
mRS.destroy();
mRS = null;
} |
@deprecated in API 16
Destroy the RenderScriptGL object associated with this
TextureView.
| RSTextureView::destroyRenderScriptGL | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
public void setRenderScriptGL(RenderScriptGL rs) {
mRS = rs;
if (mSurfaceTexture != null) {
mRS.setSurfaceTexture(mSurfaceTexture, getWidth(), getHeight());
}
} |
@deprecated in API 16
Set a new RenderScriptGL object. This also will attach the
new object to the TextureView if present.
@param rs The new RS object.
| RSTextureView::setRenderScriptGL | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
public RenderScriptGL getRenderScriptGL() {
return mRS;
} |
@deprecated in API 16
Returns the previously set RenderScriptGL object.
@return RenderScriptGL
| RSTextureView::getRenderScriptGL | java | Reginer/aosp-android-jar | android-35/src/android/renderscript/RSTextureView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/renderscript/RSTextureView.java | MIT |
default IntStream mapMulti(IntMapMultiConsumer mapper) {
Objects.requireNonNull(mapper);
return flatMap(e -> {
SpinedBuffer.OfInt buffer = new SpinedBuffer.OfInt();
mapper.accept(e, buffer);
return StreamSupport.intStream(buffer.spliterator(), false);
});
} |
Returns a stream consisting of the results of replacing each element of
this stream with multiple elements, specifically zero or more elements.
Replacement is performed by applying the provided mapping function to each
element in conjunction with a {@linkplain IntConsumer consumer} argument
that accepts replacement elements. The mapping function calls the consumer
zero or more times to provide the replacement elements.
<p>This is an <a href="package-summary.html#StreamOps">intermediate
operation</a>.
<p>If the {@linkplain IntConsumer consumer} argument is used outside the scope of
its application to the mapping function, the results are undefined.
@implSpec
The default implementation invokes {@link #flatMap flatMap} on this stream,
passing a function that behaves as follows. First, it calls the mapper function
with an {@code IntConsumer} that accumulates replacement elements into a newly created
internal buffer. When the mapper function returns, it creates an {@code IntStream} from the
internal buffer. Finally, it returns this stream to {@code flatMap}.
@param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
<a href="package-summary.html#Statelessness">stateless</a>
function that generates replacement elements
@return the new stream
@see Stream#mapMulti Stream.mapMulti
@since 16
| mapMulti | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
default IntStream takeWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
// Reuses the unordered spliterator, which, when encounter is present,
// is safe to use as long as it configured not to split
return StreamSupport.intStream(
new WhileOps.UnorderedWhileSpliterator.OfInt.Taking(spliterator(), true, predicate),
isParallel()).onClose(this::close);
} |
Returns, if this stream is ordered, a stream consisting of the longest
prefix of elements taken from this stream that match the given predicate.
Otherwise returns, if this stream is unordered, a stream consisting of a
subset of elements taken from this stream that match the given predicate.
<p>If this stream is ordered then the longest prefix is a contiguous
sequence of elements of this stream that match the given predicate. The
first element of the sequence is the first element of this stream, and
the element immediately following the last element of the sequence does
not match the given predicate.
<p>If this stream is unordered, and some (but not all) elements of this
stream match the given predicate, then the behavior of this operation is
nondeterministic; it is free to take any subset of matching elements
(which includes the empty set).
<p>Independent of whether this stream is ordered or unordered if all
elements of this stream match the given predicate then this operation
takes all elements (the result is the same as the input), or if no
elements of the stream match the given predicate then no elements are
taken (the result is an empty stream).
<p>This is a <a href="package-summary.html#StreamOps">short-circuiting
stateful intermediate operation</a>.
@implSpec
The default implementation obtains the {@link #spliterator() spliterator}
of this stream, wraps that spliterator so as to support the semantics
of this operation on traversal, and returns a new stream associated with
the wrapped spliterator. The returned stream preserves the execution
characteristics of this stream (namely parallel or sequential execution
as per {@link #isParallel()}) but the wrapped spliterator may choose to
not support splitting. When the returned stream is closed, the close
handlers for both the returned and this stream are invoked.
@apiNote
While {@code takeWhile()} is generally a cheap operation on sequential
stream pipelines, it can be quite expensive on ordered parallel
pipelines, since the operation is constrained to return not just any
valid prefix, but the longest prefix of elements in the encounter order.
Using an unordered stream source (such as {@link #generate(IntSupplier)})
or removing the ordering constraint with {@link #unordered()} may result
in significant speedups of {@code takeWhile()} in parallel pipelines, if
the semantics of your situation permit. If consistency with encounter
order is required, and you are experiencing poor performance or memory
utilization with {@code takeWhile()} in parallel pipelines, switching to
sequential execution with {@link #sequential()} may improve performance.
@param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
<a href="package-summary.html#Statelessness">stateless</a>
predicate to apply to elements to determine the longest
prefix of elements.
@return the new stream
@since 9
| takeWhile | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
default IntStream dropWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
// Reuses the unordered spliterator, which, when encounter is present,
// is safe to use as long as it configured not to split
return StreamSupport.intStream(
new WhileOps.UnorderedWhileSpliterator.OfInt.Dropping(spliterator(), true, predicate),
isParallel()).onClose(this::close);
} |
Returns, if this stream is ordered, a stream consisting of the remaining
elements of this stream after dropping the longest prefix of elements
that match the given predicate. Otherwise returns, if this stream is
unordered, a stream consisting of the remaining elements of this stream
after dropping a subset of elements that match the given predicate.
<p>If this stream is ordered then the longest prefix is a contiguous
sequence of elements of this stream that match the given predicate. The
first element of the sequence is the first element of this stream, and
the element immediately following the last element of the sequence does
not match the given predicate.
<p>If this stream is unordered, and some (but not all) elements of this
stream match the given predicate, then the behavior of this operation is
nondeterministic; it is free to drop any subset of matching elements
(which includes the empty set).
<p>Independent of whether this stream is ordered or unordered if all
elements of this stream match the given predicate then this operation
drops all elements (the result is an empty stream), or if no elements of
the stream match the given predicate then no elements are dropped (the
result is the same as the input).
<p>This is a <a href="package-summary.html#StreamOps">stateful
intermediate operation</a>.
@implSpec
The default implementation obtains the {@link #spliterator() spliterator}
of this stream, wraps that spliterator so as to support the semantics
of this operation on traversal, and returns a new stream associated with
the wrapped spliterator. The returned stream preserves the execution
characteristics of this stream (namely parallel or sequential execution
as per {@link #isParallel()}) but the wrapped spliterator may choose to
not support splitting. When the returned stream is closed, the close
handlers for both the returned and this stream are invoked.
@apiNote
While {@code dropWhile()} is generally a cheap operation on sequential
stream pipelines, it can be quite expensive on ordered parallel
pipelines, since the operation is constrained to return not just any
valid prefix, but the longest prefix of elements in the encounter order.
Using an unordered stream source (such as {@link #generate(IntSupplier)})
or removing the ordering constraint with {@link #unordered()} may result
in significant speedups of {@code dropWhile()} in parallel pipelines, if
the semantics of your situation permit. If consistency with encounter
order is required, and you are experiencing poor performance or memory
utilization with {@code dropWhile()} in parallel pipelines, switching to
sequential execution with {@link #sequential()} may improve performance.
@param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
<a href="package-summary.html#Statelessness">stateless</a>
predicate to apply to elements to determine the longest
prefix of elements.
@return the new stream
@since 9
| dropWhile | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static Builder builder() {
return new Streams.IntStreamBuilderImpl();
} |
Returns a builder for an {@code IntStream}.
@return a stream builder
| builder | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream empty() {
return StreamSupport.intStream(Spliterators.emptyIntSpliterator(), false);
} |
Returns an empty sequential {@code IntStream}.
@return an empty sequential stream
| empty | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream of(int t) {
return StreamSupport.intStream(new Streams.IntStreamBuilderImpl(t), false);
} |
Returns a sequential {@code IntStream} containing a single element.
@param t the single element
@return a singleton sequential stream
| of | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream of(int... values) {
return Arrays.stream(values);
} |
Returns a sequential ordered stream whose elements are the specified values.
@param values the elements of the new stream
@return the new stream
| of | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream iterate(final int seed, final IntUnaryOperator f) {
Objects.requireNonNull(f);
Spliterator.OfInt spliterator = new Spliterators.AbstractIntSpliterator(Long.MAX_VALUE,
Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
int prev;
boolean started;
@Override
public boolean tryAdvance(IntConsumer action) {
Objects.requireNonNull(action);
int t;
if (started)
t = f.applyAsInt(prev);
else {
t = seed;
started = true;
}
action.accept(prev = t);
return true;
}
};
return StreamSupport.intStream(spliterator, false);
} |
Returns an infinite sequential ordered {@code IntStream} produced by iterative
application of a function {@code f} to an initial element {@code seed},
producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
{@code f(f(seed))}, etc.
<p>The first element (position {@code 0}) in the {@code IntStream} will be
the provided {@code seed}. For {@code n > 0}, the element at position
{@code n}, will be the result of applying the function {@code f} to the
element at position {@code n - 1}.
<p>The action of applying {@code f} for one element
<a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
the action of applying {@code f} for subsequent elements. For any given
element the action may be performed in whatever thread the library
chooses.
@param seed the initial element
@param f a function to be applied to the previous element to produce
a new element
@return a new sequential {@code IntStream}
| iterate | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream iterate(int seed, IntPredicate hasNext, IntUnaryOperator next) {
Objects.requireNonNull(next);
Objects.requireNonNull(hasNext);
Spliterator.OfInt spliterator = new Spliterators.AbstractIntSpliterator(Long.MAX_VALUE,
Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
int prev;
boolean started, finished;
@Override
public boolean tryAdvance(IntConsumer action) {
Objects.requireNonNull(action);
if (finished)
return false;
int t;
if (started)
t = next.applyAsInt(prev);
else {
t = seed;
started = true;
}
if (!hasNext.test(t)) {
finished = true;
return false;
}
action.accept(prev = t);
return true;
}
@Override
public void forEachRemaining(IntConsumer action) {
Objects.requireNonNull(action);
if (finished)
return;
finished = true;
int t = started ? next.applyAsInt(prev) : seed;
while (hasNext.test(t)) {
action.accept(t);
t = next.applyAsInt(t);
}
}
};
return StreamSupport.intStream(spliterator, false);
} |
Returns a sequential ordered {@code IntStream} produced by iterative
application of the given {@code next} function to an initial element,
conditioned on satisfying the given {@code hasNext} predicate. The
stream terminates as soon as the {@code hasNext} predicate returns false.
<p>{@code IntStream.iterate} should produce the same sequence of elements as
produced by the corresponding for-loop:
<pre>{@code
for (int index=seed; hasNext.test(index); index = next.applyAsInt(index)) {
...
}
}</pre>
<p>The resulting sequence may be empty if the {@code hasNext} predicate
does not hold on the seed value. Otherwise the first element will be the
supplied {@code seed} value, the next element (if present) will be the
result of applying the {@code next} function to the {@code seed} value,
and so on iteratively until the {@code hasNext} predicate indicates that
the stream should terminate.
<p>The action of applying the {@code hasNext} predicate to an element
<a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
the action of applying the {@code next} function to that element. The
action of applying the {@code next} function for one element
<i>happens-before</i> the action of applying the {@code hasNext}
predicate for subsequent elements. For any given element an action may
be performed in whatever thread the library chooses.
@param seed the initial element
@param hasNext a predicate to apply to elements to determine when the
stream must terminate.
@param next a function to be applied to the previous element to produce
a new element
@return a new sequential {@code IntStream}
@since 9
| iterate | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream generate(IntSupplier s) {
Objects.requireNonNull(s);
return StreamSupport.intStream(
new StreamSpliterators.InfiniteSupplyingSpliterator.OfInt(Long.MAX_VALUE, s), false);
} |
Returns an infinite sequential unordered stream where each element is
generated by the provided {@code IntSupplier}. This is suitable for
generating constant streams, streams of random elements, etc.
@param s the {@code IntSupplier} for generated elements
@return a new infinite sequential unordered {@code IntStream}
| generate | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream range(int startInclusive, int endExclusive) {
if (startInclusive >= endExclusive) {
return empty();
} else {
return StreamSupport.intStream(
new Streams.RangeIntSpliterator(startInclusive, endExclusive, false), false);
}
} |
Returns a sequential ordered {@code IntStream} from {@code startInclusive}
(inclusive) to {@code endExclusive} (exclusive) by an incremental step of
{@code 1}.
@apiNote
<p>An equivalent sequence of increasing values can be produced
sequentially using a {@code for} loop as follows:
<pre>{@code
for (int i = startInclusive; i < endExclusive ; i++) { ... }
}</pre>
@param startInclusive the (inclusive) initial value
@param endExclusive the exclusive upper bound
@return a sequential {@code IntStream} for the range of {@code int}
elements
| range | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream rangeClosed(int startInclusive, int endInclusive) {
if (startInclusive > endInclusive) {
return empty();
} else {
return StreamSupport.intStream(
new Streams.RangeIntSpliterator(startInclusive, endInclusive, true), false);
}
} |
Returns a sequential ordered {@code IntStream} from {@code startInclusive}
(inclusive) to {@code endInclusive} (inclusive) by an incremental step of
{@code 1}.
@apiNote
<p>An equivalent sequence of increasing values can be produced
sequentially using a {@code for} loop as follows:
<pre>{@code
for (int i = startInclusive; i <= endInclusive ; i++) { ... }
}</pre>
@param startInclusive the (inclusive) initial value
@param endInclusive the inclusive upper bound
@return a sequential {@code IntStream} for the range of {@code int}
elements
| rangeClosed | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public static IntStream concat(IntStream a, IntStream b) {
Objects.requireNonNull(a);
Objects.requireNonNull(b);
Spliterator.OfInt split = new Streams.ConcatSpliterator.OfInt(
a.spliterator(), b.spliterator());
IntStream stream = StreamSupport.intStream(split, a.isParallel() || b.isParallel());
return stream.onClose(Streams.composedClose(a, b));
} |
Creates a lazily concatenated stream whose elements are all the
elements of the first stream followed by all the elements of the
second stream. The resulting stream is ordered if both
of the input streams are ordered, and parallel if either of the input
streams is parallel. When the resulting stream is closed, the close
handlers for both input streams are invoked.
<p>This method operates on the two input streams and binds each stream
to its source. As a result subsequent modifications to an input stream
source may not be reflected in the concatenated stream result.
@implNote
Use caution when constructing streams from repeated concatenation.
Accessing an element of a deeply concatenated stream can result in deep
call chains, or even {@code StackOverflowError}.
@apiNote
To preserve optimization opportunities this method binds each stream to
its source and accepts only two streams as parameters. For example, the
exact size of the concatenated stream source can be computed if the exact
size of each input stream source is known.
To concatenate more streams without binding, or without nested calls to
this method, try creating a stream of streams and flat-mapping with the
identity function, for example:
<pre>{@code
IntStream concat = Stream.of(s1, s2, s3, s4).flatMapToInt(s -> s);
}</pre>
@param a the first stream
@param b the second stream
@return the concatenation of the two input streams
| concat | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
default Builder add(int t) {
accept(t);
return this;
} |
Adds an element to the stream being built.
@implSpec
The default implementation behaves as if:
<pre>{@code
accept(t)
return this;
}</pre>
@param t the element to add
@return {@code this} builder
@throws IllegalStateException if the builder has already transitioned
to the built state
| add | java | Reginer/aosp-android-jar | android-35/src/java/util/stream/IntStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/stream/IntStream.java | MIT |
public Letterbox(Supplier<SurfaceControl.Builder> surfaceControlFactory,
Supplier<SurfaceControl.Transaction> transactionFactory,
BooleanSupplier areCornersRounded,
Supplier<Color> colorSupplier,
BooleanSupplier hasWallpaperBackgroundSupplier,
IntSupplier blurRadiusSupplier,
DoubleSupplier darkScrimAlphaSupplier,
IntConsumer doubleTapCallbackX,
IntConsumer doubleTapCallbackY,
Supplier<SurfaceControl> parentSurface) {
mSurfaceControlFactory = surfaceControlFactory;
mTransactionFactory = transactionFactory;
mAreCornersRounded = areCornersRounded;
mColorSupplier = colorSupplier;
mHasWallpaperBackgroundSupplier = hasWallpaperBackgroundSupplier;
mBlurRadiusSupplier = blurRadiusSupplier;
mDarkScrimAlphaSupplier = darkScrimAlphaSupplier;
mDoubleTapCallbackX = doubleTapCallbackX;
mDoubleTapCallbackY = doubleTapCallbackY;
mParentSurfaceSupplier = parentSurface;
} |
Constructs a Letterbox.
@param surfaceControlFactory a factory for creating the managed {@link SurfaceControl}s
| Letterbox::Letterbox | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
public void layout(Rect outer, Rect inner, Point surfaceOrigin) {
mOuter.set(outer);
mInner.set(inner);
mTop.layout(outer.left, outer.top, outer.right, inner.top, surfaceOrigin);
mLeft.layout(outer.left, outer.top, inner.left, outer.bottom, surfaceOrigin);
mBottom.layout(outer.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin);
mRight.layout(inner.right, outer.top, outer.right, outer.bottom, surfaceOrigin);
mFullWindowSurface.layout(outer.left, outer.top, outer.right, outer.bottom, surfaceOrigin);
} |
Lays out the letterbox, such that the area between the outer and inner
frames will be covered by black color surfaces.
The caller must use {@link #applySurfaceChanges} to apply the new layout to the surface.
@param outer the outer frame of the letterbox (this frame will be black, except the area
that intersects with the {code inner} frame), in global coordinates
@param inner the inner frame of the letterbox (this frame will be clear), in global
coordinates
@param surfaceOrigin the origin of the surface factory in global coordinates
| Letterbox::layout | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
public Rect getInsets() {
return new Rect(
mLeft.getWidth(),
mTop.getHeight(),
mRight.getWidth(),
mBottom.getHeight());
} |
Gets the insets between the outer and inner rects.
| Letterbox::getInsets | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
Rect getInnerFrame() {
return mInner;
} |
Gets the insets between the outer and inner rects.
public Rect getInsets() {
return new Rect(
mLeft.getWidth(),
mTop.getHeight(),
mRight.getWidth(),
mBottom.getHeight());
}
/** @return The frame that used to place the content. | Letterbox::getInnerFrame | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
Rect getOuterFrame() {
return mOuter;
} |
Gets the insets between the outer and inner rects.
public Rect getInsets() {
return new Rect(
mLeft.getWidth(),
mTop.getHeight(),
mRight.getWidth(),
mBottom.getHeight());
}
/** @return The frame that used to place the content.
Rect getInnerFrame() {
return mInner;
}
/** @return The frame that contains the inner frame and the insets. | Letterbox::getOuterFrame | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
boolean notIntersectsOrFullyContains(Rect rect) {
int emptyCount = 0;
int noOverlappingCount = 0;
for (LetterboxSurface surface : mSurfaces) {
final Rect surfaceRect = surface.mLayoutFrameGlobal;
if (surfaceRect.isEmpty()) {
// empty letterbox
emptyCount++;
} else if (!Rect.intersects(surfaceRect, rect)) {
// no overlapping
noOverlappingCount++;
} else if (surfaceRect.contains(rect)) {
// overlapping and covered
return true;
}
}
return (emptyCount + noOverlappingCount) == mSurfaces.length;
} |
Returns {@code true} if the letterbox does not overlap with the bar, or the letterbox can
fully cover the window frame.
@param rect The area of the window frame.
| Letterbox::notIntersectsOrFullyContains | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
public void hide() {
layout(EMPTY_RECT, EMPTY_RECT, ZERO_POINT);
} |
Hides the letterbox.
The caller must use {@link #applySurfaceChanges} to apply the new layout to the surface.
| Letterbox::hide | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
public void destroy() {
mOuter.setEmpty();
mInner.setEmpty();
for (LetterboxSurface surface : mSurfaces) {
surface.remove();
}
mFullWindowSurface.remove();
} |
Destroys the managed {@link SurfaceControl}s.
| Letterbox::destroy | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
public boolean needsApplySurfaceChanges() {
if (useFullWindowSurface()) {
return mFullWindowSurface.needsApplySurfaceChanges();
}
for (LetterboxSurface surface : mSurfaces) {
if (surface.needsApplySurfaceChanges()) {
return true;
}
}
return false;
} |
Destroys the managed {@link SurfaceControl}s.
public void destroy() {
mOuter.setEmpty();
mInner.setEmpty();
for (LetterboxSurface surface : mSurfaces) {
surface.remove();
}
mFullWindowSurface.remove();
}
/** Returns whether a call to {@link #applySurfaceChanges} would change the surface. | Letterbox::needsApplySurfaceChanges | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
public void applySurfaceChanges(@NonNull SurfaceControl.Transaction t,
@NonNull SurfaceControl.Transaction inputT) {
if (useFullWindowSurface()) {
mFullWindowSurface.applySurfaceChanges(t, inputT);
for (LetterboxSurface surface : mSurfaces) {
surface.remove();
}
} else {
for (LetterboxSurface surface : mSurfaces) {
surface.applySurfaceChanges(t, inputT);
}
mFullWindowSurface.remove();
}
} |
Destroys the managed {@link SurfaceControl}s.
public void destroy() {
mOuter.setEmpty();
mInner.setEmpty();
for (LetterboxSurface surface : mSurfaces) {
surface.remove();
}
mFullWindowSurface.remove();
}
/** Returns whether a call to {@link #applySurfaceChanges} would change the surface.
public boolean needsApplySurfaceChanges() {
if (useFullWindowSurface()) {
return mFullWindowSurface.needsApplySurfaceChanges();
}
for (LetterboxSurface surface : mSurfaces) {
if (surface.needsApplySurfaceChanges()) {
return true;
}
}
return false;
}
/** Applies surface changes such as colour, window crop, position and input info. | Letterbox::applySurfaceChanges | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
void attachInput(WindowState win) {
if (useFullWindowSurface()) {
mFullWindowSurface.attachInput(win);
} else {
for (LetterboxSurface surface : mSurfaces) {
surface.attachInput(win);
}
}
} |
Destroys the managed {@link SurfaceControl}s.
public void destroy() {
mOuter.setEmpty();
mInner.setEmpty();
for (LetterboxSurface surface : mSurfaces) {
surface.remove();
}
mFullWindowSurface.remove();
}
/** Returns whether a call to {@link #applySurfaceChanges} would change the surface.
public boolean needsApplySurfaceChanges() {
if (useFullWindowSurface()) {
return mFullWindowSurface.needsApplySurfaceChanges();
}
for (LetterboxSurface surface : mSurfaces) {
if (surface.needsApplySurfaceChanges()) {
return true;
}
}
return false;
}
/** Applies surface changes such as colour, window crop, position and input info.
public void applySurfaceChanges(@NonNull SurfaceControl.Transaction t,
@NonNull SurfaceControl.Transaction inputT) {
if (useFullWindowSurface()) {
mFullWindowSurface.applySurfaceChanges(t, inputT);
for (LetterboxSurface surface : mSurfaces) {
surface.remove();
}
} else {
for (LetterboxSurface surface : mSurfaces) {
surface.applySurfaceChanges(t, inputT);
}
mFullWindowSurface.remove();
}
}
/** Enables touches to slide into other neighboring surfaces. | Letterbox::attachInput | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
private boolean useFullWindowSurface() {
return mAreCornersRounded.getAsBoolean() || mHasWallpaperBackgroundSupplier.getAsBoolean();
} |
Returns {@code true} when using {@link #mFullWindowSurface} instead of {@link mSurfaces}.
| Letterbox::useFullWindowSurface | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/Letterbox.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/Letterbox.java | MIT |
Request() {
reset();
} |
Ensure constructed request matches reset instance.
| Request::Request | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/ActivityStarter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/ActivityStarter.java | MIT |
void reset() {
caller = null;
intent = null;
intentGrants = null;
ephemeralIntent = null;
resolvedType = null;
activityInfo = null;
resolveInfo = null;
voiceSession = null;
voiceInteractor = null;
resultTo = null;
resultWho = null;
requestCode = 0;
callingPid = DEFAULT_CALLING_PID;
callingUid = DEFAULT_CALLING_UID;
callingPackage = null;
callingFeatureId = null;
realCallingPid = DEFAULT_REAL_CALLING_PID;
realCallingUid = DEFAULT_REAL_CALLING_UID;
startFlags = 0;
activityOptions = null;
ignoreTargetSecurity = false;
componentSpecified = false;
outActivity = null;
inTask = null;
inTaskFragment = null;
reason = null;
profilerInfo = null;
globalConfig = null;
userId = 0;
waitResult = null;
avoidMoveToFront = false;
allowPendingRemoteAnimationRegistryLookup = true;
filterCallingUid = UserHandle.USER_NULL;
originatingPendingIntent = null;
allowBackgroundActivityStart = false;
errorCallbackToken = null;
} |
Sets values back to the initial state, clearing any held references.
| Request::reset | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/ActivityStarter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/ActivityStarter.java | MIT |
void set(@NonNull Request request) {
caller = request.caller;
intent = request.intent;
intentGrants = request.intentGrants;
ephemeralIntent = request.ephemeralIntent;
resolvedType = request.resolvedType;
activityInfo = request.activityInfo;
resolveInfo = request.resolveInfo;
voiceSession = request.voiceSession;
voiceInteractor = request.voiceInteractor;
resultTo = request.resultTo;
resultWho = request.resultWho;
requestCode = request.requestCode;
callingPid = request.callingPid;
callingUid = request.callingUid;
callingPackage = request.callingPackage;
callingFeatureId = request.callingFeatureId;
realCallingPid = request.realCallingPid;
realCallingUid = request.realCallingUid;
startFlags = request.startFlags;
activityOptions = request.activityOptions;
ignoreTargetSecurity = request.ignoreTargetSecurity;
componentSpecified = request.componentSpecified;
outActivity = request.outActivity;
inTask = request.inTask;
inTaskFragment = request.inTaskFragment;
reason = request.reason;
profilerInfo = request.profilerInfo;
globalConfig = request.globalConfig;
userId = request.userId;
waitResult = request.waitResult;
avoidMoveToFront = request.avoidMoveToFront;
allowPendingRemoteAnimationRegistryLookup
= request.allowPendingRemoteAnimationRegistryLookup;
filterCallingUid = request.filterCallingUid;
originatingPendingIntent = request.originatingPendingIntent;
allowBackgroundActivityStart = request.allowBackgroundActivityStart;
errorCallbackToken = request.errorCallbackToken;
} |
Adopts all values from passed in request.
| Request::set | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/ActivityStarter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/ActivityStarter.java | MIT |
void resolveActivity(ActivityTaskSupervisor supervisor) {
if (realCallingPid == Request.DEFAULT_REAL_CALLING_PID) {
realCallingPid = Binder.getCallingPid();
}
if (realCallingUid == Request.DEFAULT_REAL_CALLING_UID) {
realCallingUid = Binder.getCallingUid();
}
if (callingUid >= 0) {
callingPid = -1;
} else if (caller == null) {
callingPid = realCallingPid;
callingUid = realCallingUid;
} else {
callingPid = callingUid = -1;
}
// To determine the set of needed Uri permission grants, we need the
// "resolved" calling UID, where we try our best to identify the
// actual caller that is starting this activity
int resolvedCallingUid = callingUid;
if (caller != null) {
synchronized (supervisor.mService.mGlobalLock) {
final WindowProcessController callerApp = supervisor.mService
.getProcessController(caller);
if (callerApp != null) {
resolvedCallingUid = callerApp.mInfo.uid;
}
}
}
// Save a copy in case ephemeral needs it
ephemeralIntent = new Intent(intent);
// Don't modify the client's object!
intent = new Intent(intent);
if (intent.getComponent() != null
&& !(Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() == null)
&& !Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE.equals(intent.getAction())
&& !Intent.ACTION_RESOLVE_INSTANT_APP_PACKAGE.equals(intent.getAction())
&& supervisor.mService.getPackageManagerInternalLocked()
.isInstantAppInstallerComponent(intent.getComponent())) {
// Intercept intents targeted directly to the ephemeral installer the ephemeral
// installer should never be started with a raw Intent; instead adjust the intent
// so it looks like a "normal" instant app launch.
intent.setComponent(null /* component */);
}
resolveInfo = supervisor.resolveIntent(intent, resolvedType, userId,
0 /* matchFlags */,
computeResolveFilterUid(callingUid, realCallingUid, filterCallingUid));
if (resolveInfo == null) {
final UserInfo userInfo = supervisor.getUserInfo(userId);
if (userInfo != null && userInfo.isManagedProfile()) {
// Special case for managed profiles, if attempting to launch non-cryto aware
// app in a locked managed profile from an unlocked parent allow it to resolve
// as user will be sent via confirm credentials to unlock the profile.
final UserManager userManager = UserManager.get(supervisor.mService.mContext);
boolean profileLockedAndParentUnlockingOrUnlocked = false;
final long token = Binder.clearCallingIdentity();
try {
final UserInfo parent = userManager.getProfileParent(userId);
profileLockedAndParentUnlockingOrUnlocked = (parent != null)
&& userManager.isUserUnlockingOrUnlocked(parent.id)
&& !userManager.isUserUnlockingOrUnlocked(userId);
} finally {
Binder.restoreCallingIdentity(token);
}
if (profileLockedAndParentUnlockingOrUnlocked) {
resolveInfo = supervisor.resolveIntent(intent, resolvedType, userId,
PackageManager.MATCH_DIRECT_BOOT_AWARE
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
computeResolveFilterUid(callingUid, realCallingUid,
filterCallingUid));
}
}
}
// Collect information about the target of the Intent.
activityInfo = supervisor.resolveActivity(intent, resolveInfo, startFlags,
profilerInfo);
// Carefully collect grants without holding lock
if (activityInfo != null) {
intentGrants = supervisor.mService.mUgmInternal.checkGrantUriPermissionFromIntent(
intent, resolvedCallingUid, activityInfo.applicationInfo.packageName,
UserHandle.getUserId(activityInfo.applicationInfo.uid));
}
} |
Resolve activity from the given intent for this launch.
| Request::resolveActivity | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/ActivityStarter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/ActivityStarter.java | MIT |
void set(ActivityStarter starter) {
mStartActivity = starter.mStartActivity;
mIntent = starter.mIntent;
mCallingUid = starter.mCallingUid;
mOptions = starter.mOptions;
mRestrictedBgActivity = starter.mRestrictedBgActivity;
mLaunchTaskBehind = starter.mLaunchTaskBehind;
mLaunchFlags = starter.mLaunchFlags;
mLaunchMode = starter.mLaunchMode;
mLaunchParams.set(starter.mLaunchParams);
mNotTop = starter.mNotTop;
mDoResume = starter.mDoResume;
mStartFlags = starter.mStartFlags;
mSourceRecord = starter.mSourceRecord;
mPreferredTaskDisplayArea = starter.mPreferredTaskDisplayArea;
mPreferredWindowingMode = starter.mPreferredWindowingMode;
mInTask = starter.mInTask;
mInTaskFragment = starter.mInTaskFragment;
mAddingToTask = starter.mAddingToTask;
mNewTaskInfo = starter.mNewTaskInfo;
mNewTaskIntent = starter.mNewTaskIntent;
mSourceRootTask = starter.mSourceRootTask;
mTargetTask = starter.mTargetTask;
mTargetRootTask = starter.mTargetRootTask;
mIsTaskCleared = starter.mIsTaskCleared;
mMovedToFront = starter.mMovedToFront;
mNoAnimation = starter.mNoAnimation;
mAvoidMoveToFront = starter.mAvoidMoveToFront;
mFrozeTaskList = starter.mFrozeTaskList;
mVoiceSession = starter.mVoiceSession;
mVoiceInteractor = starter.mVoiceInteractor;
mIntentDelivered = starter.mIntentDelivered;
mLastStartActivityResult = starter.mLastStartActivityResult;
mLastStartActivityTimeMs = starter.mLastStartActivityTimeMs;
mLastStartReason = starter.mLastStartReason;
mRequest.set(starter.mRequest);
} |
Effectively duplicates the starter passed in. All state and request values will be
mirrored.
@param starter
| Request::set | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/ActivityStarter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/ActivityStarter.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.