OperatingSystem { public static String getHostName() { if (Platform.isWindows()) { return Kernel32Util.getComputerName(); } else { byte[] hostnameBuffer = new byte[257]; int result = CLibrary.INSTANCE.gethostname(hostnameBuffer, hostnameBuffer.length); if (result != 0) { int lastError = Native.getLastError(); throw new UnixRuntimeException("Error code " + CLibrary.INSTANCE.strerror(lastError) + " for gethostname(byyte[], 256)", lastError); } return Native.toString(hostnameBuffer); } } private  OperatingSystem(); static boolean isMacOsx(); static boolean isWindows(); static String getOsName(); static OperatingSystemMXBean getOSMbean(); @Nullable static com.sun.management.OperatingSystemMXBean getSunJdkOSMBean(); @Nullable static UnixOperatingSystemMXBean getUnixOsMBean(); static long getOpenFileDescriptorCount(); static String getHostName(); static long getMaxFileDescriptorCount(); static int killProcess(final Process proc, final long terminateTimeoutMillis,
          final long forceTerminateTimeoutMillis); @SuppressFBWarnings({ "COMMAND_INJECTION", "CC_CYCLOMATIC_COMPLEXITY" }) static ProcessResponse<T, E> forkExec(final String[] command, final ProcessHandler<T, E> handler,
          final long timeoutMillis, final long terminationTimeoutMillis); @CheckReturnValue static String forkExec(final String[] command,
          final long timeoutMillis); static void forkExecLog(final String[] command,
          final long timeoutMillis); static final long MAX_NR_OPENFILES; }
@Test public void testGetHostName() { String hostName = OperatingSystem.getHostName(); LOG.debug("host name is {}", hostName); Assert.assertNotNull(hostName); }