private static String connectDetail(InetAddress inetAddress, int port, int timeoutMs, ErrnoException cause) { String detail = "failed to connect to " + inetAddress + " (port " + port + ")"; if (timeoutMs > 0) { detail += " after " + timeoutMs + "ms"; } if (cause != null) { detail += ": " + cause.getMessage(); } return detail; }
public SocketException rethrowAsSocketException() throws SocketException { throw new SocketException(getMessage(), this); } }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public static void bind(FileDescriptor fd, InetAddress address, int port) throws SocketException { if (address instanceof Inet6Address && ((Inet6Address) address).getScopeId() == 0) { // Linux won't let you bind a link-local address without a scope id. Find one. NetworkInterface nif = NetworkInterface.getByInetAddress(address); if (nif == null) { throw new SocketException("Can't bind to a link-local address without a scope id: " + address); } try { address = Inet6Address.getByAddress(address.getHostName(), address.getAddress(), nif.getIndex()); } catch (UnknownHostException ex) { throw new AssertionError(ex); // Can't happen. } } try { Libcore.os.bind(fd, address, port); } catch (ErrnoException errnoException) { throw new BindException(errnoException.getMessage(), errnoException); } }
/** * Ensures that data which is buffered within the underlying implementation * is written out to the appropriate device before returning. */ public void sync() throws SyncFailedException { try { if (Libcore.os.isatty(this)) { Libcore.os.tcdrain(this); } else { Libcore.os.fsync(this); } } catch (ErrnoException errnoException) { SyncFailedException sfe = new SyncFailedException(errnoException.getMessage()); sfe.initCause(errnoException); throw sfe; } }
FileNotFoundException ex = new FileNotFoundException(path + ": " + errnoException.getMessage()); ex.initCause(errnoException); throw ex;
private static String connectDetail(InetAddress inetAddress, int port, int timeoutMs, ErrnoException cause) { String detail = "failed to connect to " + inetAddress + " (port " + port + ")"; if (timeoutMs > 0) { detail += " after " + timeoutMs + "ms"; } if (cause != null) { detail += ": " + cause.getMessage(); } return detail; }
private static String connectDetail(InetAddress inetAddress, int port, int timeoutMs, ErrnoException cause) { String detail = "failed to connect to " + inetAddress + " (port " + port + ")"; if (timeoutMs > 0) { detail += " after " + timeoutMs + "ms"; } if (cause != null) { detail += ": " + cause.getMessage(); } return detail; }
private static String connectDetail(InetAddress inetAddress, int port, int timeoutMs, ErrnoException cause) { String detail = "failed to connect to " + inetAddress + " (port " + port + ")"; if (timeoutMs > 0) { detail += " after " + timeoutMs + "ms"; } if (cause != null) { detail += ": " + cause.getMessage(); } return detail; }
private static String connectDetail(InetAddress inetAddress, int port, int timeoutMs, ErrnoException cause) { String detail = "failed to connect to " + inetAddress + " (port " + port + ")"; if (timeoutMs > 0) { detail += " after " + timeoutMs + "ms"; } if (cause != null) { detail += ": " + cause.getMessage(); } return detail; }
private static String connectDetail(InetAddress inetAddress, int port, int timeoutMs, ErrnoException cause) { String detail = "failed to connect to " + inetAddress + " (port " + port + ")"; if (timeoutMs > 0) { detail += " after " + timeoutMs + "ms"; } if (cause != null) { detail += ": " + cause.getMessage(); } return detail; }
public SocketException rethrowAsSocketException() throws SocketException { throw new SocketException(getMessage(), this); } }
public SocketException rethrowAsSocketException() throws SocketException { throw new SocketException(getMessage(), this); } }
public SocketException rethrowAsSocketException() throws SocketException { throw new SocketException(getMessage(), this); } }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }
public IOException rethrowAsIOException() throws IOException { IOException newException = new IOException(getMessage()); newException.initCause(this); throw newException; }