code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
protected FilterInputStream(InputStream in) {
this.in = in;
} |
Creates a <code>FilterInputStream</code>
by assigning the argument <code>in</code>
to the field <code>this.in</code> so as
to remember it for later use.
@param in the underlying input stream, or <code>null</code> if
this instance is to be created without an underlying stream.
| FilterInputStream::FilterInputStream | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public int read() throws IOException {
return in.read();
} |
Reads the next byte of data from this input stream. The value
byte is returned as an <code>int</code> in the range
<code>0</code> to <code>255</code>. If no byte is available
because the end of the stream has been reached, the value
<code>-1</code> is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
<p>
This method
simply performs <code>in.read()</code> and returns the result.
@return the next byte of data, or <code>-1</code> if the end of the
stream is reached.
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#in
| FilterInputStream::read | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public int read(byte b[]) throws IOException {
return read(b, 0, b.length);
} |
Reads up to <code>b.length</code> bytes of data from this
input stream into an array of bytes. This method blocks until some
input is available.
<p>
This method simply performs the call
<code>read(b, 0, b.length)</code> and returns
the result. It is important that it does
<i>not</i> do <code>in.read(b)</code> instead;
certain subclasses of <code>FilterInputStream</code>
depend on the implementation strategy actually
used.
@param b the buffer into which the data is read.
@return the total number of bytes read into the buffer, or
<code>-1</code> if there is no more data because the end of
the stream has been reached.
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#read(byte[], int, int)
| FilterInputStream::read | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public int read(byte b[], int off, int len) throws IOException {
return in.read(b, off, len);
} |
Reads up to <code>len</code> bytes of data from this input stream
into an array of bytes. If <code>len</code> is not zero, the method
blocks until some input is available; otherwise, no
bytes are read and <code>0</code> is returned.
<p>
This method simply performs <code>in.read(b, off, len)</code>
and returns the result.
@param b the buffer into which the data is read.
@param off the start offset in the destination array <code>b</code>
@param len the maximum number of bytes read.
@return the total number of bytes read into the buffer, or
<code>-1</code> if there is no more data because the end of
the stream has been reached.
@exception NullPointerException If <code>b</code> is <code>null</code>.
@exception IndexOutOfBoundsException If <code>off</code> is negative,
<code>len</code> is negative, or <code>len</code> is greater than
<code>b.length - off</code>
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#in
| FilterInputStream::read | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public long skip(long n) throws IOException {
return in.skip(n);
} |
Skips over and discards <code>n</code> bytes of data from the
input stream. The <code>skip</code> method may, for a variety of
reasons, end up skipping over some smaller number of bytes,
possibly <code>0</code>. The actual number of bytes skipped is
returned.
<p>
This method simply performs <code>in.skip(n)</code>.
@param n the number of bytes to be skipped.
@return the actual number of bytes skipped.
@throws IOException if {@code in.skip(n)} throws an IOException.
| FilterInputStream::skip | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public int available() throws IOException {
return in.available();
} |
Returns an estimate of the number of bytes that can be read (or
skipped over) from this input stream without blocking by the next
caller of a method for this input stream. The next caller might be
the same thread or another thread. A single read or skip of this
many bytes will not block, but may read or skip fewer bytes.
<p>
This method returns the result of {@link #in in}.available().
@return an estimate of the number of bytes that can be read (or skipped
over) from this input stream without blocking.
@exception IOException if an I/O error occurs.
| FilterInputStream::available | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public void close() throws IOException {
in.close();
} |
Closes this input stream and releases any system resources
associated with the stream.
This
method simply performs <code>in.close()</code>.
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#in
| FilterInputStream::close | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public synchronized void mark(int readlimit) {
in.mark(readlimit);
} |
Marks the current position in this input stream. A subsequent
call to the <code>reset</code> method repositions this stream at
the last marked position so that subsequent reads re-read the same bytes.
<p>
The <code>readlimit</code> argument tells this input stream to
allow that many bytes to be read before the mark position gets
invalidated.
<p>
This method simply performs <code>in.mark(readlimit)</code>.
@param readlimit the maximum limit of bytes that can be read before
the mark position becomes invalid.
@see java.io.FilterInputStream#in
@see java.io.FilterInputStream#reset()
| FilterInputStream::mark | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public synchronized void reset() throws IOException {
in.reset();
} |
Repositions this stream to the position at the time the
<code>mark</code> method was last called on this input stream.
<p>
This method
simply performs <code>in.reset()</code>.
<p>
Stream marks are intended to be used in
situations where you need to read ahead a little to see what's in
the stream. Often this is most easily done by invoking some
general parser. If the stream is of the type handled by the
parse, it just chugs along happily. If the stream is not of
that type, the parser should toss an exception when it fails.
If this happens within readlimit bytes, it allows the outer
code to reset the stream and try another parser.
@exception IOException if the stream has not been marked or if the
mark has been invalidated.
@see java.io.FilterInputStream#in
@see java.io.FilterInputStream#mark(int)
| FilterInputStream::reset | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public boolean markSupported() {
return in.markSupported();
} |
Tests if this input stream supports the <code>mark</code>
and <code>reset</code> methods.
This method
simply performs <code>in.markSupported()</code>.
@return <code>true</code> if this stream type supports the
<code>mark</code> and <code>reset</code> method;
<code>false</code> otherwise.
@see java.io.FilterInputStream#in
@see java.io.InputStream#mark(int)
@see java.io.InputStream#reset()
| FilterInputStream::markSupported | java | Reginer/aosp-android-jar | android-35/src/java/io/FilterInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/io/FilterInputStream.java | MIT |
public LineNumberInputStream(InputStream in) {
super(in);
} |
Constructs a newline number input stream that reads its input
from the specified input stream.
@param in the underlying input stream.
| LineNumberInputStream::LineNumberInputStream | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public int read(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
int c = read();
if (c == -1) {
return -1;
}
b[off] = (byte)c;
int i = 1;
try {
for (; i < len ; i++) {
c = read();
if (c == -1) {
break;
}
if (b != null) {
b[off + i] = (byte)c;
}
}
} catch (IOException ee) {
}
return i;
} |
Reads up to {@code len} bytes of data from this input stream
into an array of bytes. This method blocks until some input is available.
<p>
The {@code read} method of
{@code LineNumberInputStream} repeatedly calls the
{@code read} method of zero arguments to fill in the byte array.
@param b the buffer into which the data is read.
@param off the start offset of the data.
@param len the maximum number of bytes read.
@return the total number of bytes read into the buffer, or
{@code -1} if there is no more data because the end of
this stream has been reached.
@exception IOException if an I/O error occurs.
@see java.io.LineNumberInputStream#read()
| LineNumberInputStream::read | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public long skip(long n) throws IOException {
int chunk = 2048;
long remaining = n;
byte data[];
int nr;
if (n <= 0) {
return 0;
}
data = new byte[chunk];
while (remaining > 0) {
nr = read(data, 0, (int) Math.min(chunk, remaining));
if (nr < 0) {
break;
}
remaining -= nr;
}
return n - remaining;
} |
Skips over and discards {@code n} bytes of data from this
input stream. The {@code skip} method may, for a variety of
reasons, end up skipping over some smaller number of bytes,
possibly {@code 0}. The actual number of bytes skipped is
returned. If {@code n} is negative, no bytes are skipped.
<p>
The {@code skip} method of {@code LineNumberInputStream} creates
a byte array and then repeatedly reads into it until
{@code n} bytes have been read or the end of the stream has
been reached.
@param n the number of bytes to be skipped.
@return the actual number of bytes skipped.
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#in
| LineNumberInputStream::skip | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
} |
Sets the line number to the specified argument.
@param lineNumber the new line number.
@see #getLineNumber
| LineNumberInputStream::setLineNumber | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public int getLineNumber() {
return lineNumber;
} |
Returns the current line number.
@return the current line number.
@see #setLineNumber
| LineNumberInputStream::getLineNumber | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public int available() throws IOException {
return (pushBack == -1) ? super.available()/2 : super.available()/2 + 1;
} |
Returns the number of bytes that can be read from this input
stream without blocking.
<p>
Note that if the underlying input stream is able to supply
<i>k</i> input characters without blocking, the
{@code LineNumberInputStream} can guarantee only to provide
<i>k</i>/2 characters without blocking, because the
<i>k</i> characters from the underlying input stream might
consist of <i>k</i>/2 pairs of {@code '\u005Cr'} and
{@code '\u005Cn'}, which are converted to just
<i>k</i>/2 {@code '\u005Cn'} characters.
@return the number of bytes that can be read from this input stream
without blocking.
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#in
| LineNumberInputStream::available | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public void mark(int readlimit) {
markLineNumber = lineNumber;
markPushBack = pushBack;
in.mark(readlimit);
} |
Marks the current position in this input stream. A subsequent
call to the {@code reset} method repositions this stream at
the last marked position so that subsequent reads re-read the same bytes.
<p>
The {@code mark} method of
{@code LineNumberInputStream} remembers the current line
number in a private variable, and then calls the {@code mark}
method of the underlying input stream.
@param readlimit the maximum limit of bytes that can be read before
the mark position becomes invalid.
@see java.io.FilterInputStream#in
@see java.io.LineNumberInputStream#reset()
| LineNumberInputStream::mark | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public void reset() throws IOException {
lineNumber = markLineNumber;
pushBack = markPushBack;
in.reset();
} |
Repositions this stream to the position at the time the
{@code mark} method was last called on this input stream.
<p>
The {@code reset} method of
{@code LineNumberInputStream} resets the line number to be
the line number at the time the {@code mark} method was
called, and then calls the {@code reset} method of the
underlying input stream.
<p>
Stream marks are intended to be used in
situations where you need to read ahead a little to see what's in
the stream. Often this is most easily done by invoking some
general parser. If the stream is of the type handled by the
parser, it just chugs along happily. If the stream is not of
that type, the parser should toss an exception when it fails,
which, if it happens within readlimit bytes, allows the outer
code to reset the stream and try another parser.
@exception IOException if an I/O error occurs.
@see java.io.FilterInputStream#in
@see java.io.LineNumberInputStream#mark(int)
| LineNumberInputStream::reset | java | Reginer/aosp-android-jar | android-31/src/java/io/LineNumberInputStream.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/io/LineNumberInputStream.java | MIT |
public boolean start() {
if (!onCorrectThread()) {
throw new IllegalStateException("start() called from off-thread");
}
return createAndRegisterFd();
} |
This class encapsulates the mechanics of registering a file descriptor
with a thread's Looper and handling read events (and errors).
Subclasses MUST implement createFd() and SHOULD override handlePacket(). They MAY override
onStop() and onStart().
Subclasses can expect a call life-cycle like the following:
[1] when a client calls start(), createFd() is called, followed by the onStart() hook if all
goes well. Implementations may override onStart() for additional initialization.
[2] yield, waiting for read event or error notification:
[a] readPacket() && handlePacket()
[b] if (no error):
goto 2
else:
goto 3
[3] when a client calls stop(), the onStop() hook is called (unless already stopped or never
started). Implementations may override onStop() for additional cleanup.
The packet receive buffer is recycled on every read call, so subclasses
should make any copies they would like inside their handlePacket()
implementation.
All public methods MUST only be called from the same thread with which
the Handler constructor argument is associated.
@param <BufferType> the type of the buffer used to read data.
public abstract class FdEventsReader<BufferType> {
private static final String TAG = FdEventsReader.class.getSimpleName();
private static final int FD_EVENTS = EVENT_INPUT | EVENT_ERROR;
private static final int UNREGISTER_THIS_FD = 0;
@NonNull
private final Handler mHandler;
@NonNull
private final MessageQueue mQueue;
@NonNull
private final BufferType mBuffer;
@Nullable
private FileDescriptor mFd;
private long mPacketsReceived;
protected static void closeFd(FileDescriptor fd) {
try {
SocketUtils.closeSocket(fd);
} catch (IOException ignored) {
}
}
protected FdEventsReader(@NonNull Handler h, @NonNull BufferType buffer) {
mHandler = h;
mQueue = mHandler.getLooper().getQueue();
mBuffer = buffer;
}
@VisibleForTesting
@NonNull
protected MessageQueue getMessageQueue() {
return mQueue;
}
/** Start this FdEventsReader. | FdEventsReader::start | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
public void stop() {
if (!onCorrectThread()) {
throw new IllegalStateException("stop() called from off-thread");
}
unregisterAndDestroyFd();
} |
This class encapsulates the mechanics of registering a file descriptor
with a thread's Looper and handling read events (and errors).
Subclasses MUST implement createFd() and SHOULD override handlePacket(). They MAY override
onStop() and onStart().
Subclasses can expect a call life-cycle like the following:
[1] when a client calls start(), createFd() is called, followed by the onStart() hook if all
goes well. Implementations may override onStart() for additional initialization.
[2] yield, waiting for read event or error notification:
[a] readPacket() && handlePacket()
[b] if (no error):
goto 2
else:
goto 3
[3] when a client calls stop(), the onStop() hook is called (unless already stopped or never
started). Implementations may override onStop() for additional cleanup.
The packet receive buffer is recycled on every read call, so subclasses
should make any copies they would like inside their handlePacket()
implementation.
All public methods MUST only be called from the same thread with which
the Handler constructor argument is associated.
@param <BufferType> the type of the buffer used to read data.
public abstract class FdEventsReader<BufferType> {
private static final String TAG = FdEventsReader.class.getSimpleName();
private static final int FD_EVENTS = EVENT_INPUT | EVENT_ERROR;
private static final int UNREGISTER_THIS_FD = 0;
@NonNull
private final Handler mHandler;
@NonNull
private final MessageQueue mQueue;
@NonNull
private final BufferType mBuffer;
@Nullable
private FileDescriptor mFd;
private long mPacketsReceived;
protected static void closeFd(FileDescriptor fd) {
try {
SocketUtils.closeSocket(fd);
} catch (IOException ignored) {
}
}
protected FdEventsReader(@NonNull Handler h, @NonNull BufferType buffer) {
mHandler = h;
mQueue = mHandler.getLooper().getQueue();
mBuffer = buffer;
}
@VisibleForTesting
@NonNull
protected MessageQueue getMessageQueue() {
return mQueue;
}
/** Start this FdEventsReader.
public boolean start() {
if (!onCorrectThread()) {
throw new IllegalStateException("start() called from off-thread");
}
return createAndRegisterFd();
}
/** Stop this FdEventsReader and destroy the file descriptor. | FdEventsReader::stop | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
public int recvBufSize() {
return recvBufSize(mBuffer);
} |
This class encapsulates the mechanics of registering a file descriptor
with a thread's Looper and handling read events (and errors).
Subclasses MUST implement createFd() and SHOULD override handlePacket(). They MAY override
onStop() and onStart().
Subclasses can expect a call life-cycle like the following:
[1] when a client calls start(), createFd() is called, followed by the onStart() hook if all
goes well. Implementations may override onStart() for additional initialization.
[2] yield, waiting for read event or error notification:
[a] readPacket() && handlePacket()
[b] if (no error):
goto 2
else:
goto 3
[3] when a client calls stop(), the onStop() hook is called (unless already stopped or never
started). Implementations may override onStop() for additional cleanup.
The packet receive buffer is recycled on every read call, so subclasses
should make any copies they would like inside their handlePacket()
implementation.
All public methods MUST only be called from the same thread with which
the Handler constructor argument is associated.
@param <BufferType> the type of the buffer used to read data.
public abstract class FdEventsReader<BufferType> {
private static final String TAG = FdEventsReader.class.getSimpleName();
private static final int FD_EVENTS = EVENT_INPUT | EVENT_ERROR;
private static final int UNREGISTER_THIS_FD = 0;
@NonNull
private final Handler mHandler;
@NonNull
private final MessageQueue mQueue;
@NonNull
private final BufferType mBuffer;
@Nullable
private FileDescriptor mFd;
private long mPacketsReceived;
protected static void closeFd(FileDescriptor fd) {
try {
SocketUtils.closeSocket(fd);
} catch (IOException ignored) {
}
}
protected FdEventsReader(@NonNull Handler h, @NonNull BufferType buffer) {
mHandler = h;
mQueue = mHandler.getLooper().getQueue();
mBuffer = buffer;
}
@VisibleForTesting
@NonNull
protected MessageQueue getMessageQueue() {
return mQueue;
}
/** Start this FdEventsReader.
public boolean start() {
if (!onCorrectThread()) {
throw new IllegalStateException("start() called from off-thread");
}
return createAndRegisterFd();
}
/** Stop this FdEventsReader and destroy the file descriptor.
public void stop() {
if (!onCorrectThread()) {
throw new IllegalStateException("stop() called from off-thread");
}
unregisterAndDestroyFd();
}
@NonNull
public Handler getHandler() {
return mHandler;
}
protected abstract int recvBufSize(@NonNull BufferType buffer);
/** Returns the size of the receive buffer. | FdEventsReader::recvBufSize | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
public final long numPacketsReceived() {
return mPacketsReceived;
} |
Get the number of successful calls to {@link #readPacket(FileDescriptor, Object)}.
<p>A call was successful if {@link #readPacket(FileDescriptor, Object)} returned a value > 0.
| FdEventsReader::numPacketsReceived | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
protected void handlePacket(@NonNull BufferType recvbuf, int length) {} |
Called by the main loop for every packet. Any desired copies of
|recvbuf| should be made in here, as the underlying byte array is
reused across all reads.
| FdEventsReader::handlePacket | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
protected boolean handleReadError(@NonNull ErrnoException e) {
logError("readPacket error: ", e);
return true; // by default, stop reading on any error.
} |
Called by the subclasses of FdEventsReader, decide whether it should stop reading packet or
just ignore the specific error other than EAGAIN or EINTR.
@return {@code true} if this FdEventsReader should stop reading from the socket.
{@code false} if it should continue.
| FdEventsReader::handleReadError | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
protected void logError(@NonNull String msg, @Nullable Exception e) {} |
Called by the main loop to log errors. In some cases |e| may be null.
| FdEventsReader::logError | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
protected void onStart() {} |
Called by start(), if successful, just prior to returning.
| FdEventsReader::onStart | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
protected void onStop() {} |
Called by stop() just prior to returning.
| FdEventsReader::onStop | java | Reginer/aosp-android-jar | android-33/src/com/android/net/module/util/FdEventsReader.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/net/module/util/FdEventsReader.java | MIT |
public static Bundle saveState(SslCertificate certificate) {
if (certificate == null) {
return null;
}
Bundle bundle = new Bundle();
bundle.putString(ISSUED_TO, certificate.getIssuedTo().getDName());
bundle.putString(ISSUED_BY, certificate.getIssuedBy().getDName());
bundle.putString(VALID_NOT_BEFORE, certificate.getValidNotBefore());
bundle.putString(VALID_NOT_AFTER, certificate.getValidNotAfter());
X509Certificate x509Certificate = certificate.mX509Certificate;
if (x509Certificate != null) {
try {
bundle.putByteArray(X509_CERTIFICATE, x509Certificate.getEncoded());
} catch (CertificateEncodingException ignored) {
}
}
return bundle;
} |
Saves the certificate state to a bundle
@param certificate The SSL certificate to store
@return A bundle with the certificate stored in it or null if fails
| SslCertificate::saveState | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public static SslCertificate restoreState(Bundle bundle) {
if (bundle == null) {
return null;
}
X509Certificate x509Certificate;
byte[] bytes = bundle.getByteArray(X509_CERTIFICATE);
if (bytes == null) {
x509Certificate = null;
} else {
try {
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
Certificate cert = certFactory.generateCertificate(new ByteArrayInputStream(bytes));
x509Certificate = (X509Certificate) cert;
} catch (CertificateException e) {
x509Certificate = null;
}
}
return new SslCertificate(bundle.getString(ISSUED_TO),
bundle.getString(ISSUED_BY),
parseDate(bundle.getString(VALID_NOT_BEFORE)),
parseDate(bundle.getString(VALID_NOT_AFTER)),
x509Certificate);
} |
Restores the certificate stored in the bundle
@param bundle The bundle with the certificate state stored in it
@return The SSL certificate stored in the bundle or null if fails
| SslCertificate::restoreState | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public SslCertificate(X509Certificate certificate) {
this(certificate.getSubjectDN().getName(),
certificate.getIssuerDN().getName(),
certificate.getNotBefore(),
certificate.getNotAfter(),
certificate);
} |
Creates a new SSL certificate object from an X509 certificate
@param certificate X509 certificate
| SslCertificate::SslCertificate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public Date getValidNotBeforeDate() {
return cloneDate(mValidNotBefore);
} |
@return Not-before date from the certificate validity period or
"" if none has been set
| SslCertificate::getValidNotBeforeDate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public Date getValidNotAfterDate() {
return cloneDate(mValidNotAfter);
} |
@return Not-after date from the certificate validity period or
"" if none has been set
| SslCertificate::getValidNotAfterDate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public DName getIssuedTo() {
return mIssuedTo;
} |
@return Issued-to distinguished name or null if none has been set
| SslCertificate::getIssuedTo | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public DName getIssuedBy() {
return mIssuedBy;
} |
@return Issued-by distinguished name or null if none has been set
| SslCertificate::getIssuedBy | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public @Nullable X509Certificate getX509Certificate() {
return mX509Certificate;
} |
@return The {@code X509Certificate} used to create this {@code SslCertificate} or
{@code null} if no certificate was provided.
| SslCertificate::getX509Certificate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public String toString() {
return ("Issued to: " + mIssuedTo.getDName() + ";\n"
+ "Issued by: " + mIssuedBy.getDName() + ";\n");
} |
@return A string representation of this certificate for debugging
| SslCertificate::toString | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
private static Date parseDate(String string) {
try {
return new SimpleDateFormat(ISO_8601_DATE_FORMAT).parse(string);
} catch (ParseException e) {
return null;
}
} |
Parse an ISO 8601 date converting ParseExceptions to a null result;
| SslCertificate::parseDate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
private static String formatDate(Date date) {
if (date == null) {
return "";
}
return new SimpleDateFormat(ISO_8601_DATE_FORMAT).format(date);
} |
Format a date as an ISO 8601 string, return "" for a null date
| SslCertificate::formatDate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
private static Date cloneDate(Date date) {
if (date == null) {
return null;
}
return (Date) date.clone();
} |
Clone a possibly null Date
| SslCertificate::cloneDate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public DName(String dName) {
if (dName != null) {
mDName = dName;
try {
X509Name x509Name = new X509Name(dName);
Vector val = x509Name.getValues();
Vector oid = x509Name.getOIDs();
for (int i = 0; i < oid.size(); i++) {
if (oid.elementAt(i).equals(X509Name.CN)) {
if (mCName == null) {
mCName = (String) val.elementAt(i);
}
continue;
}
if (oid.elementAt(i).equals(X509Name.O)) {
if (mOName == null) {
mOName = (String) val.elementAt(i);
continue;
}
}
if (oid.elementAt(i).equals(X509Name.OU)) {
if (mUName == null) {
mUName = (String) val.elementAt(i);
continue;
}
}
}
} catch (IllegalArgumentException ex) {
// thrown if there is an error parsing the string
}
}
} |
Creates a new {@code DName} from a string. The attributes
are assumed to come in most significant to least
significant order which is true of human readable values
returned by methods such as {@code X500Principal.getName()}.
Be aware that the underlying sources of distinguished names
such as instances of {@code X509Certificate} are encoded in
least significant to most significant order, so make sure
the value passed here has the expected ordering of
attributes.
| DName::DName | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public String getDName() {
return mDName != null ? mDName : "";
} |
@return The distinguished name (normally includes CN, O, and OU names)
| DName::getDName | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public String getCName() {
return mCName != null ? mCName : "";
} |
@return The most specific Common-name (CN) component of this name
| DName::getCName | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public String getOName() {
return mOName != null ? mOName : "";
} |
@return The most specific Organization (O) component of this name
| DName::getOName | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public String getUName() {
return mUName != null ? mUName : "";
} |
@return The most specific Organizational Unit (OU) component of this name
| DName::getUName | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
private String formatCertificateDate(Context context, Date certificateDate) {
if (certificateDate == null) {
return "";
}
return DateFormat.getMediumDateFormat(context).format(certificateDate);
} |
Formats the certificate date to a properly localized date string.
@return Properly localized version of the certificate date string and
the "" if it fails to localize.
| DName::formatCertificateDate | java | Reginer/aosp-android-jar | android-31/src/android/net/http/SslCertificate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/http/SslCertificate.java | MIT |
public HttpURLConnectionFactory() {
} |
A way to construct {@link java.net.HttpURLConnection}s that supports some
configuration on a per-factory or per-connection basis rather than only via
global static state such as {@link java.net.CookieHandler#setDefault(java.net.CookieHandler)}.
The per-factory configuration is <b>optional</b>; if not set, global
configuration or default behavior is used.
This facade prevents tight coupling with the underlying implementation (on
top of a particular version of OkHttp). Android code outside of libcore
should never depend directly on OkHttp.
This abstraction is not suitable for general use. Talk to the maintainers of
this class before modifying it or adding additional dependencies.
@hide
@hide This class is not part of the Android public SDK API
public final class HttpURLConnectionFactory {
private ConnectionPool connectionPool;
private com.android.okhttp.Dns dns;
/** @hide | HttpURLConnectionFactory::HttpURLConnectionFactory | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
public void setNewConnectionPool(int maxIdleConnections, long keepAliveDuration,
TimeUnit timeUnit) {
this.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit);
} |
Sets a new ConnectionPool, specific to this URLFactory and not shared with
any other connections, with the given configuration.
@hide
| HttpURLConnectionFactory::setNewConnectionPool | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
public void setDns(Dns dns) {
Objects.requireNonNull(dns);
this.dns = new DnsAdapter(dns);
} |
Sets a new ConnectionPool, specific to this URLFactory and not shared with
any other connections, with the given configuration.
@hide
public void setNewConnectionPool(int maxIdleConnections, long keepAliveDuration,
TimeUnit timeUnit) {
this.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit);
}
/** @hide | HttpURLConnectionFactory::setDns | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
public URLConnection openConnection(URL url) throws IOException {
return internalOpenConnection(url, null /* socketFactory */, null /* proxy */);
} |
Opens a connection that uses the system default proxy settings and SocketFactory.
@hide
| HttpURLConnectionFactory::openConnection | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
public URLConnection openConnection(URL url, Proxy proxy) throws IOException {
Objects.requireNonNull(proxy);
return internalOpenConnection(url, null /* socketFactory */, proxy);
} |
Opens a connection that uses the system default SocketFactory and the specified
proxy settings.
@hide
| HttpURLConnectionFactory::openConnection | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
public URLConnection openConnection(URL url, SocketFactory socketFactory) throws IOException {
Objects.requireNonNull(socketFactory);
return internalOpenConnection(url, socketFactory, null /* proxy */);
} |
Opens a connection that uses the specified SocketFactory and the system default
proxy settings.
@hide
| HttpURLConnectionFactory::openConnection | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
public URLConnection openConnection(URL url, SocketFactory socketFactory, Proxy proxy)
throws IOException {
Objects.requireNonNull(socketFactory);
Objects.requireNonNull(proxy);
return internalOpenConnection(url, socketFactory, proxy);
} |
Opens a connection using the specified SocketFactory and the specified proxy
settings, overriding any system wide configuration.
@hide
| HttpURLConnectionFactory::openConnection | java | Reginer/aosp-android-jar | android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java | MIT |
private JapaneseChronology() {
} |
Restricted constructor.
| JapaneseChronology::JapaneseChronology | java | Reginer/aosp-android-jar | android-34/src/java/time/chrono/JapaneseChronology.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/time/chrono/JapaneseChronology.java | MIT |
public PKIXCertPathBuilderResult(CertPath certPath,
TrustAnchor trustAnchor, PolicyNode policyTree,
PublicKey subjectPublicKey)
{
super(trustAnchor, policyTree, subjectPublicKey);
if (certPath == null)
throw new NullPointerException("certPath must be non-null");
this.certPath = certPath;
} |
Creates an instance of {@code PKIXCertPathBuilderResult}
containing the specified parameters.
@param certPath the validated {@code CertPath}
@param trustAnchor a {@code TrustAnchor} describing the CA that
served as a trust anchor for the certification path
@param policyTree the immutable valid policy tree, or {@code null}
if there are no valid policies
@param subjectPublicKey the public key of the subject
@throws NullPointerException if the {@code certPath},
{@code trustAnchor} or {@code subjectPublicKey} parameters
are {@code null}
| PKIXCertPathBuilderResult::PKIXCertPathBuilderResult | java | Reginer/aosp-android-jar | android-33/src/java/security/cert/PKIXCertPathBuilderResult.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/security/cert/PKIXCertPathBuilderResult.java | MIT |
public CertPath getCertPath() {
return certPath;
} |
Returns the built and validated certification path. The
{@code CertPath} object does not include the trust anchor.
Instead, use the {@link #getTrustAnchor() getTrustAnchor()} method to
obtain the {@code TrustAnchor} that served as the trust anchor
for the certification path.
@return the built and validated {@code CertPath} (never
{@code null})
| PKIXCertPathBuilderResult::getCertPath | java | Reginer/aosp-android-jar | android-33/src/java/security/cert/PKIXCertPathBuilderResult.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/security/cert/PKIXCertPathBuilderResult.java | MIT |
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("PKIXCertPathBuilderResult: [\n");
sb.append(" Certification Path: " + certPath + "\n");
sb.append(" Trust Anchor: " + getTrustAnchor().toString() + "\n");
sb.append(" Policy Tree: " + String.valueOf(getPolicyTree()) + "\n");
sb.append(" Subject Public Key: " + getPublicKey() + "\n");
sb.append("]");
return sb.toString();
} |
Return a printable representation of this
{@code PKIXCertPathBuilderResult}.
@return a {@code String} describing the contents of this
{@code PKIXCertPathBuilderResult}
| PKIXCertPathBuilderResult::toString | java | Reginer/aosp-android-jar | android-33/src/java/security/cert/PKIXCertPathBuilderResult.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/security/cert/PKIXCertPathBuilderResult.java | MIT |
public void setTextSize(float size) {
if (mTextPaint.getTextSize() != size) {
mTextPaint.setTextSize(size);
mInnerPaddingX = (int) (size * INNER_PADDING_RATIO + 0.5f);
mHasMeasurements = false;
requestLayout();
invalidate();
}
} |
Sets the text size in pixels.
@param size the text size in pixels
| SubtitleView::setTextSize | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/widget/SubtitleView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/widget/SubtitleView.java | MIT |
public boolean isConnectable() {
return mConnectable;
} |
Returns whether the advertisement will be connectable.
| AdvertisingSetParameters::isConnectable | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public boolean isScannable() {
return mScannable;
} |
Returns whether the advertisement will be scannable.
| AdvertisingSetParameters::isScannable | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public boolean isLegacy() {
return mIsLegacy;
} |
Returns whether the legacy advertisement will be used.
| AdvertisingSetParameters::isLegacy | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public boolean isAnonymous() {
return mIsAnonymous;
} |
Returns whether the advertisement will be anonymous.
| AdvertisingSetParameters::isAnonymous | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public boolean includeTxPower() {
return mIncludeTxPower;
} |
Returns whether the TX Power will be included.
| AdvertisingSetParameters::includeTxPower | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public int getPrimaryPhy() {
return mPrimaryPhy;
} |
Returns the primary advertising phy.
| AdvertisingSetParameters::getPrimaryPhy | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public int getSecondaryPhy() {
return mSecondaryPhy;
} |
Returns the secondary advertising phy.
| AdvertisingSetParameters::getSecondaryPhy | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public int getInterval() {
return mInterval;
} |
Returns the advertising interval.
| AdvertisingSetParameters::getInterval | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public int getTxPowerLevel() {
return mTxPowerLevel;
} |
Returns the TX power level for advertising.
| AdvertisingSetParameters::getTxPowerLevel | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setConnectable(boolean connectable) {
mConnectable = connectable;
return this;
} |
Set whether the advertisement type should be connectable or
non-connectable.
Legacy advertisements can be both connectable and scannable. Non-legacy
advertisements can be only scannable or only connectable.
@param connectable Controls whether the advertisement type will be connectable (true) or
non-connectable (false).
| Builder::setConnectable | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setScannable(boolean scannable) {
mScannable = scannable;
return this;
} |
Set whether the advertisement type should be scannable.
Legacy advertisements can be both connectable and scannable. Non-legacy
advertisements can be only scannable or only connectable.
@param scannable Controls whether the advertisement type will be scannable (true) or
non-scannable (false).
| Builder::setScannable | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setLegacyMode(boolean isLegacy) {
mIsLegacy = isLegacy;
return this;
} |
When set to true, advertising set will advertise 4.x Spec compliant
advertisements.
@param isLegacy whether legacy advertising mode should be used.
| Builder::setLegacyMode | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setAnonymous(boolean isAnonymous) {
mIsAnonymous = isAnonymous;
return this;
} |
Set whether advertiser address should be ommited from all packets. If this
mode is used, periodic advertising can't be enabled for this set.
This is used only if legacy mode is not used.
@param isAnonymous whether anonymous advertising should be used.
| Builder::setAnonymous | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setIncludeTxPower(boolean includeTxPower) {
mIncludeTxPower = includeTxPower;
return this;
} |
Set whether TX power should be included in the extended header.
This is used only if legacy mode is not used.
@param includeTxPower whether TX power should be included in extended header
| Builder::setIncludeTxPower | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setPrimaryPhy(int primaryPhy) {
if (primaryPhy != BluetoothDevice.PHY_LE_1M
&& primaryPhy != BluetoothDevice.PHY_LE_CODED) {
throw new IllegalArgumentException("bad primaryPhy " + primaryPhy);
}
mPrimaryPhy = primaryPhy;
return this;
} |
Set the primary physical channel used for this advertising set.
This is used only if legacy mode is not used.
Use {@link BluetoothAdapter#isLeCodedPhySupported} to determine if LE Coded PHY is
supported on this device.
@param primaryPhy Primary advertising physical channel, can only be {@link
BluetoothDevice#PHY_LE_1M} or {@link BluetoothDevice#PHY_LE_CODED}.
@throws IllegalArgumentException If the primaryPhy is invalid.
| Builder::setPrimaryPhy | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setSecondaryPhy(int secondaryPhy) {
if (secondaryPhy != BluetoothDevice.PHY_LE_1M
&& secondaryPhy != BluetoothDevice.PHY_LE_2M
&& secondaryPhy != BluetoothDevice.PHY_LE_CODED) {
throw new IllegalArgumentException("bad secondaryPhy " + secondaryPhy);
}
mSecondaryPhy = secondaryPhy;
return this;
} |
Set the secondary physical channel used for this advertising set.
This is used only if legacy mode is not used.
Use {@link BluetoothAdapter#isLeCodedPhySupported} and
{@link BluetoothAdapter#isLe2MPhySupported} to determine if LE Coded PHY or 2M PHY is
supported on this device.
@param secondaryPhy Secondary advertising physical channel, can only be one of {@link
BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M} or {@link
BluetoothDevice#PHY_LE_CODED}.
@throws IllegalArgumentException If the secondaryPhy is invalid.
| Builder::setSecondaryPhy | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setInterval(int interval) {
if (interval < INTERVAL_MIN || interval > INTERVAL_MAX) {
throw new IllegalArgumentException("unknown interval " + interval);
}
mInterval = interval;
return this;
} |
Set advertising interval.
@param interval Bluetooth LE Advertising interval, in 0.625ms unit. Valid range is from
160 (100ms) to 16777215 (10,485.759375 s). Recommended values are: {@link
AdvertisingSetParameters#INTERVAL_LOW}, {@link AdvertisingSetParameters#INTERVAL_MEDIUM},
or {@link AdvertisingSetParameters#INTERVAL_HIGH}.
@throws IllegalArgumentException If the interval is invalid.
| Builder::setInterval | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public Builder setTxPowerLevel(int txPowerLevel) {
if (txPowerLevel < TX_POWER_MIN || txPowerLevel > TX_POWER_MAX) {
throw new IllegalArgumentException("unknown txPowerLevel " + txPowerLevel);
}
mTxPowerLevel = txPowerLevel;
return this;
} |
Set the transmission power level for the advertising.
@param txPowerLevel Transmission power of Bluetooth LE Advertising, in dBm. The valid
range is [-127, 1] Recommended values are:
{@link AdvertisingSetParameters#TX_POWER_ULTRA_LOW},
{@link AdvertisingSetParameters#TX_POWER_LOW},
{@link AdvertisingSetParameters#TX_POWER_MEDIUM},
or {@link AdvertisingSetParameters#TX_POWER_HIGH}.
@throws IllegalArgumentException If the {@code txPowerLevel} is invalid.
| Builder::setTxPowerLevel | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public AdvertisingSetParameters build() {
if (mIsLegacy) {
if (mIsAnonymous) {
throw new IllegalArgumentException("Legacy advertising can't be anonymous");
}
if (mConnectable && !mScannable) {
throw new IllegalStateException(
"Legacy advertisement can't be connectable and non-scannable");
}
if (mIncludeTxPower) {
throw new IllegalStateException(
"Legacy advertising can't include TX power level in header");
}
} else {
if (mConnectable && mScannable) {
throw new IllegalStateException(
"Advertising can't be both connectable and scannable");
}
if (mIsAnonymous && mConnectable) {
throw new IllegalStateException(
"Advertising can't be both connectable and anonymous");
}
}
return new AdvertisingSetParameters(mConnectable, mScannable, mIsLegacy, mIsAnonymous,
mIncludeTxPower, mPrimaryPhy, mSecondaryPhy, mInterval, mTxPowerLevel);
} |
Build the {@link AdvertisingSetParameters} object.
@throws IllegalStateException if invalid combination of parameters is used.
| Builder::build | java | Reginer/aosp-android-jar | android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/bluetooth/le/AdvertisingSetParameters.java | MIT |
public static Scene getSceneForLayout(ViewGroup sceneRoot, int layoutId, Context context) {
SparseArray<Scene> scenes = (SparseArray<Scene>) sceneRoot.getTag(
com.android.internal.R.id.scene_layoutid_cache);
if (scenes == null) {
scenes = new SparseArray<Scene>();
sceneRoot.setTagInternal(com.android.internal.R.id.scene_layoutid_cache, scenes);
}
Scene scene = scenes.get(layoutId);
if (scene != null) {
return scene;
} else {
scene = new Scene(sceneRoot, layoutId, context);
scenes.put(layoutId, scene);
return scene;
}
} |
Returns a Scene described by the resource file associated with the given
<code>layoutId</code> parameter. If such a Scene has already been created for
the given <code>sceneRoot</code>, that same Scene will be returned.
This caching of layoutId-based scenes enables sharing of common scenes
between those created in code and those referenced by {@link TransitionManager}
XML resource files.
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
@param layoutId The id of a standard layout resource file.
@param context The context used in the process of inflating
the layout resource.
@return The scene for the given root and layout id
| Scene::getSceneForLayout | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public Scene(ViewGroup sceneRoot) {
mSceneRoot = sceneRoot;
} |
Constructs a Scene with no information about how values will change
when this scene is applied. This constructor might be used when
a Scene is created with the intention of being dynamically configured,
through setting {@link #setEnterAction(Runnable)} and possibly
{@link #setExitAction(Runnable)}.
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
| Scene::Scene | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
private Scene(ViewGroup sceneRoot, int layoutId, Context context) {
mContext = context;
mSceneRoot = sceneRoot;
mLayoutId = layoutId;
} |
Constructs a Scene which, when entered, will remove any
children from the sceneRoot container and will inflate and add
the hierarchy specified by the layoutId resource file.
<p>This method is hidden because layoutId-based scenes should be
created by the caching factory method {@link Scene#getCurrentScene(ViewGroup)}.</p>
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
@param layoutId The id of a resource file that defines the view
hierarchy of this scene.
@param context The context used in the process of inflating
the layout resource.
| Scene::Scene | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public Scene(ViewGroup sceneRoot, View layout) {
mSceneRoot = sceneRoot;
mLayout = layout;
} |
Constructs a Scene which, when entered, will remove any
children from the sceneRoot container and add the layout
object as a new child of that container.
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
@param layout The view hierarchy of this scene, added as a child
of sceneRoot when this scene is entered.
| Scene::Scene | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public ViewGroup getSceneRoot() {
return mSceneRoot;
} |
Gets the root of the scene, which is the root of the view hierarchy
affected by changes due to this scene, and which will be animated
when this scene is entered.
@return The root of the view hierarchy affected by this scene.
| Scene::getSceneRoot | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public void exit() {
if (getCurrentScene(mSceneRoot) == this) {
if (mExitAction != null) {
mExitAction.run();
}
}
} |
Exits this scene, if it is the current scene
on the scene's {@link #getSceneRoot() scene root}. The current scene is
set when {@link #enter() entering} a scene.
Exiting a scene runs the {@link #setExitAction(Runnable) exit action}
if there is one.
| Scene::exit | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public void enter() {
// Apply layout change, if any
if (mLayoutId > 0 || mLayout != null) {
// empty out parent container before adding to it
getSceneRoot().removeAllViews();
if (mLayoutId > 0) {
LayoutInflater.from(mContext).inflate(mLayoutId, mSceneRoot);
} else {
mSceneRoot.addView(mLayout);
}
}
// Notify next scene that it is entering. Subclasses may override to configure scene.
if (mEnterAction != null) {
mEnterAction.run();
}
setCurrentScene(mSceneRoot, this);
} |
Enters this scene, which entails changing all values that
are specified by this scene. These may be values associated
with a layout view group or layout resource file which will
now be added to the scene root, or it may be values changed by
an {@link #setEnterAction(Runnable)} enter action}, or a
combination of the these. No transition will be run when the
scene is entered. To get transition behavior in scene changes,
use one of the methods in {@link TransitionManager} instead.
| Scene::enter | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public void setEnterAction(Runnable action) {
mEnterAction = action;
} |
Scenes that are not defined with layout resources or
hierarchies, or which need to perform additional steps
after those hierarchies are changed to, should set an enter
action, and possibly an exit action as well. An enter action
will cause Scene to call back into application code to do
anything else the application needs after transitions have
captured pre-change values and after any other scene changes
have been applied, such as the layout (if any) being added to
the view hierarchy. After this method is called, Transitions will
be played.
@param action The runnable whose {@link Runnable#run() run()} method will
be called when this scene is entered
@see #setExitAction(Runnable)
@see Scene#Scene(ViewGroup, View)
| Scene::setEnterAction | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public void setExitAction(Runnable action) {
mExitAction = action;
} |
Scenes that are not defined with layout resources or
hierarchies, or which need to perform additional steps
after those hierarchies are changed to, should set an enter
action, and possibly an exit action as well. An exit action
will cause Scene to call back into application code to do
anything the application needs to do after applicable transitions have
captured pre-change values, but before any other scene changes
have been applied, such as the new layout (if any) being added to
the view hierarchy. After this method is called, the next scene
will be entered, including a call to {@link #setEnterAction(Runnable)}
if an enter action is set.
@see #setEnterAction(Runnable)
@see Scene#Scene(ViewGroup, View)
| Scene::setExitAction | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
boolean isCreatedFromLayoutResource() {
return (mLayoutId > 0);
} |
Returns whether this Scene was created by a layout resource file, determined
by the layoutId passed into
{@link #getSceneForLayout(android.view.ViewGroup, int, android.content.Context)}.
This is called by TransitionManager to determine whether it is safe for views from
this scene to be removed from their parents when the scene is exited, which is
used by {@link Fade} to fade these views out (the views must be removed from
their parent in order to add them to the overlay for fading purposes). If a
Scene is not based on a resource file, then the impact of removing views
arbitrarily is unknown and should be avoided.
| Scene::isCreatedFromLayoutResource | java | Reginer/aosp-android-jar | android-32/src/android/transition/Scene.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/transition/Scene.java | MIT |
public SearchSpec(@NonNull Bundle bundle) {
Objects.requireNonNull(bundle);
mBundle = bundle;
} |
Results should be grouped together by namespace for the purpose of enforcing a limit on the
number of results returned per namespace.
public static final int GROUPING_TYPE_PER_NAMESPACE = 0b10;
private final Bundle mBundle;
/** @hide | SearchSpec::SearchSpec | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public @TermMatch int getTermMatch() {
return mBundle.getInt(TERM_MATCH_TYPE_FIELD, -1);
} |
Returns the {@link Bundle} populated by this builder.
@hide
@NonNull
public Bundle getBundle() {
return mBundle;
}
/** Returns how the query terms should match terms in the index. | SearchSpec::getTermMatch | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public int getResultCountPerPage() {
return mBundle.getInt(NUM_PER_PAGE_FIELD, DEFAULT_NUM_PER_PAGE);
} |
Returns the list of package name filters to search over.
<p>If empty, the query will search over all packages that the caller has access to. If
package names are specified which caller doesn't have access to, then those package names
will be ignored.
@NonNull
public List<String> getFilterPackageNames() {
List<String> packageNames = mBundle.getStringArrayList(PACKAGE_NAME_FIELD);
if (packageNames == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(packageNames);
}
/** Returns the number of results per page in the result set. | SearchSpec::getResultCountPerPage | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public @RankingStrategy int getRankingStrategy() {
return mBundle.getInt(RANKING_STRATEGY_FIELD);
} |
Returns the list of package name filters to search over.
<p>If empty, the query will search over all packages that the caller has access to. If
package names are specified which caller doesn't have access to, then those package names
will be ignored.
@NonNull
public List<String> getFilterPackageNames() {
List<String> packageNames = mBundle.getStringArrayList(PACKAGE_NAME_FIELD);
if (packageNames == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(packageNames);
}
/** Returns the number of results per page in the result set.
public int getResultCountPerPage() {
return mBundle.getInt(NUM_PER_PAGE_FIELD, DEFAULT_NUM_PER_PAGE);
}
/** Returns the ranking strategy. | SearchSpec::getRankingStrategy | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public @Order int getOrder() {
return mBundle.getInt(ORDER_FIELD);
} |
Returns the list of package name filters to search over.
<p>If empty, the query will search over all packages that the caller has access to. If
package names are specified which caller doesn't have access to, then those package names
will be ignored.
@NonNull
public List<String> getFilterPackageNames() {
List<String> packageNames = mBundle.getStringArrayList(PACKAGE_NAME_FIELD);
if (packageNames == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(packageNames);
}
/** Returns the number of results per page in the result set.
public int getResultCountPerPage() {
return mBundle.getInt(NUM_PER_PAGE_FIELD, DEFAULT_NUM_PER_PAGE);
}
/** Returns the ranking strategy.
public @RankingStrategy int getRankingStrategy() {
return mBundle.getInt(RANKING_STRATEGY_FIELD);
}
/** Returns the order of returned search results (descending or ascending). | SearchSpec::getOrder | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public int getSnippetCount() {
return mBundle.getInt(SNIPPET_COUNT_FIELD);
} |
Returns the list of package name filters to search over.
<p>If empty, the query will search over all packages that the caller has access to. If
package names are specified which caller doesn't have access to, then those package names
will be ignored.
@NonNull
public List<String> getFilterPackageNames() {
List<String> packageNames = mBundle.getStringArrayList(PACKAGE_NAME_FIELD);
if (packageNames == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(packageNames);
}
/** Returns the number of results per page in the result set.
public int getResultCountPerPage() {
return mBundle.getInt(NUM_PER_PAGE_FIELD, DEFAULT_NUM_PER_PAGE);
}
/** Returns the ranking strategy.
public @RankingStrategy int getRankingStrategy() {
return mBundle.getInt(RANKING_STRATEGY_FIELD);
}
/** Returns the order of returned search results (descending or ascending).
public @Order int getOrder() {
return mBundle.getInt(ORDER_FIELD);
}
/** Returns how many documents to generate snippets for. | SearchSpec::getSnippetCount | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public int getSnippetCountPerProperty() {
return mBundle.getInt(SNIPPET_COUNT_PER_PROPERTY_FIELD);
} |
Returns how many matches for each property of a matching document to generate snippets for.
| SearchSpec::getSnippetCountPerProperty | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public int getMaxSnippetSize() {
return mBundle.getInt(MAX_SNIPPET_FIELD);
} |
Returns how many matches for each property of a matching document to generate snippets for.
public int getSnippetCountPerProperty() {
return mBundle.getInt(SNIPPET_COUNT_PER_PROPERTY_FIELD);
}
/** Returns the maximum size of a snippet in characters. | SearchSpec::getMaxSnippetSize | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public @GroupingType int getResultGroupingTypeFlags() {
return mBundle.getInt(RESULT_GROUPING_TYPE_FLAGS);
} |
Get the type of grouping limit to apply, or 0 if {@link Builder#setResultGrouping} was not
called.
| SearchSpec::getResultGroupingTypeFlags | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
public int getResultGroupingLimit() {
return mBundle.getInt(RESULT_GROUPING_LIMIT, Integer.MAX_VALUE);
} |
Get the maximum number of results to return for each group.
@return the maximum number of results to return for each group or Integer.MAX_VALUE if {@link
Builder#setResultGrouping(int, int)} was not called.
| SearchSpec::getResultGroupingLimit | java | Reginer/aosp-android-jar | android-31/src/android/app/appsearch/SearchSpec.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/appsearch/SearchSpec.java | MIT |
private WifiP2pServiceRequest(int serviceType, int length,
int transId, String query) {
mProtocolType = serviceType;
mLength = length;
mTransId = transId;
mQuery = query;
} |
This constructor is only used in Parcelable.
@param serviceType service discovery type.
@param length the length of service discovery packet.
@param transId the transaction id
@param query The part of service specific query.
| WifiP2pServiceRequest::WifiP2pServiceRequest | java | Reginer/aosp-android-jar | android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | MIT |
public int getTransactionId() {
return mTransId;
} |
Return transaction id.
@return transaction id
@hide
| WifiP2pServiceRequest::getTransactionId | java | Reginer/aosp-android-jar | android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | MIT |
public void setTransactionId(int id) {
mTransId = id;
} |
Set transaction id.
@param id
@hide
| WifiP2pServiceRequest::setTransactionId | java | Reginer/aosp-android-jar | android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | MIT |
public String getSupplicantQuery() {
StringBuffer sb = new StringBuffer();
// length is retained as little endian format.
sb.append(String.format(Locale.US, "%02x", (mLength) & 0xff));
sb.append(String.format(Locale.US, "%02x", (mLength >> 8) & 0xff));
sb.append(String.format(Locale.US, "%02x", mProtocolType));
sb.append(String.format(Locale.US, "%02x", mTransId));
if (mQuery != null) {
sb.append(mQuery);
}
return sb.toString();
} |
Return wpa_supplicant request string.
The format is the hex dump of the following frame.
<pre>
_______________________________________________________________
| Length (2) | Type (1) | Transaction ID (1) |
| Query Data (variable) |
</pre>
@return wpa_supplicant request string.
@hide
| WifiP2pServiceRequest::getSupplicantQuery | java | Reginer/aosp-android-jar | android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.