Samual Sam has Published 2492 Articles

ftp_quit() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

54 Views

The ftp_quit() function is an alias to ftp_close(). It closes an FTP connection.Syntaxftp_quit(con);Parameterscon − The connection to close.ReturnThe ftp_quit() function returns TRUE on success or FALSE on failureExampleThe following is an example that login to a connection works in it to change the directory and then the connection is closed ... Read More

Parsing and Formatting a Byte Array into Decimal in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

2K+ Views

Set a BigInteger object.BigInteger one;Now, create a ByteArray −byte byteArr[] = new byte[] { 0x1, 0x00, 0x00 }; one = new BigInteger(byteArr);For Decimal, we have used toString() method without any parameter value.String strResult = one.toString();The following is an example −Example Live Demoimport java.math.*; public class Demo { public ... Read More

How to use subSet() method of Java NavigableSet Class

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

111 Views

Use the subset() method to get elements from a limit. At first, create NavigableSet and add elements −NavigableSet set = new TreeSet(); set.add(10); set.add(25); set.add(40); set.add(55); set.add(70); set.add(85);Now, use the subset() method −set.subSet(40, 85)The following is an example to implement subset() method of Java NaviagbleSet class −Example Live Demoimport java.util.NavigableSet; import ... Read More

Java Program to get name of parent directory

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

208 Views

The name of the parent directory of the file or directory can be obtained using the method java.io.File.getParent(). This method returns the parent directory pathname string or null if there is no parent named.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo {   ... Read More

Convert BigInteger into another radix number in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

874 Views

First, create a BigInteger.BigInteger val = new BigInteger("198");Let us convert it to Binary, with radix as 2.val.toString(2);Convert it to Octal, with radix as 8.val.toString(8);Convert it to HexaDecimal, with radix as 16.val.toString(16);The following is an example −Example Live Demoimport java.math.BigInteger; public class Main { public static void main(String[] args) ... Read More

ftp_rawlist() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

55 Views

The ftp_rawlist() function displays the list of files with file information from a specified directorySyntaxftp_rawlist(conn, dir, recursive);Parametersconn − The FTP connectiondir − The directory pathrecursive − Sends a "LIST" command to the server by default.ReturnThe ftp_rawlist() function returns an array where each element corresponds to one line of text.ExampleThe following ... Read More

Java Program to get the content of a directory

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

149 Views

The contents of a directory can be obtained using the method java.io.File.listFiles(). This method requires no parameters and it returns the abstract path names that specify the files and directories in the required directory.A program that demonstrates this is given as follows −Exampleimport java.io.File; public class Demo {    public ... Read More

Get byte array from BigInteger in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

182 Views

First, set the BigInteger object with binary.BigInteger val = new BigInteger("100000000110001100000", 2);Now, use the toByteArray() method.byte[] byteArr = val.toByteArray();The following is an example −Example Live Demoimport java.math.BigInteger; public class Demo { public static void main(String[] argv) throws Exception { BigInteger val = ... Read More

Delete file or directory on termination in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

233 Views

A file or directory can be deleted on termination of the program i.e. after the virtual machine terminates using the method java.io.File.deleteOnExit(). This method requires no parameters and it does not return a value.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo {   ... Read More

ftp_rmdir() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

41 Views

The ftp_rmdir() function deletes a directory on the FTP server. Remember that the directory to be deleted should be empty.Syntaxftp_rmdir(conn, dir);Parametersconn −The FTP connectiondir − The empty directory to be deleted.ReturnThe ftp_rmdir() function returnsTRUE on success or FALSE on failure.ExampleThe following is an example −Read More

Advertisements