summaryrefslogtreecommitdiff
path: root/core/java/android/net/LocalSocketImpl.java
diff options
context:
space:
mode:
authorSerik Beketayev <serikb@google.com>2021-02-02 15:04:43 -0800
committerSerik Beketayev <serikb@google.com>2021-02-04 06:40:03 +0000
commit63be51447826b077a1048901bb1aa73adb321ee1 (patch)
tree6c623a283206a95071e4e36fe7c06e00e52416bd /core/java/android/net/LocalSocketImpl.java
parent3736a5cd86d882f93a55e5a4848f69fe0f84766d (diff)
[Mainline] android.system package APIs migration
By removing Int32Ref. Bug: 177619520 Test: mma Change-Id: I9b63146ae563ed977f3112c9910f7a7c575de0b8 (cherry picked from commit 1a2d570c3a7122940097aa7e983a7240d163c41a)
Diffstat (limited to 'core/java/android/net/LocalSocketImpl.java')
-rw-r--r--core/java/android/net/LocalSocketImpl.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index e01e5aecc7e6..f7c1c4bb6d96 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -19,7 +19,6 @@ package android.net;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.system.ErrnoException;
-import android.system.Int32Ref;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructLinger;
@@ -65,14 +64,11 @@ class LocalSocketImpl
public int available() throws IOException {
FileDescriptor myFd = fd;
if (myFd == null) throw new IOException("socket closed");
-
- Int32Ref avail = new Int32Ref(0);
try {
- Os.ioctlInt(myFd, OsConstants.FIONREAD, avail);
+ return Os.ioctlInt(myFd, OsConstants.FIONREAD);
} catch (ErrnoException e) {
throw e.rethrowAsIOException();
}
- return avail.value;
}
/** {@inheritDoc} */
@@ -134,7 +130,7 @@ class LocalSocketImpl
public void write (byte[] b) throws IOException {
write(b, 0, b.length);
}
-
+
/** {@inheritDoc} */
@Override
public void write (byte[] b, int off, int len) throws IOException {
@@ -255,7 +251,7 @@ class LocalSocketImpl
/** note timeout presently ignored */
protected void connect(LocalSocketAddress address, int timeout)
throws IOException
- {
+ {
if (fd == null) {
throw new IOException("socket not created");
}
@@ -339,7 +335,7 @@ class LocalSocketImpl
* @throws IOException if socket has been closed or cannot be created.
*/
protected OutputStream getOutputStream() throws IOException
- {
+ {
if (fd == null) {
throw new IOException("socket not created");
}