Package com.klaytn.caver.ipfs
Class IPFS
- java.lang.Object
-
- com.klaytn.caver.ipfs.IPFS
-
public class IPFS extends java.lang.Object
This class represents uploading and getting file from IPFS.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
add(byte[] content)
Add byte array to IPFSjava.lang.String
add(java.lang.String path)
Add file to IPFS.static java.lang.String
fromHex(java.lang.String hexString)
Encode hex string with Base58 algorithm.byte[]
get(java.lang.String encodedHash)
Get file from IPFS.void
setIPFSNode(java.lang.String host, int port, boolean ssl)
Set a IPFS node.static java.lang.String
toHex(java.lang.String encodedHash)
Decode encoded multi hash string with Base58 and add hex prefix(0x).
-
-
-
Method Detail
-
toHex
public static java.lang.String toHex(java.lang.String encodedHash)
Decode encoded multi hash string with Base58 and add hex prefix(0x).- Parameters:
encodedHash
- A encoded string with Base58.- Returns:
- String
-
fromHex
public static java.lang.String fromHex(java.lang.String hexString)
Encode hex string with Base58 algorithm.- Parameters:
hexString
- A hex string to encode.- Returns:
- String
-
add
public java.lang.String add(java.lang.String path) throws java.io.IOException
Add file to IPFS.- Parameters:
path
- A file path to add at IPFS.- Returns:
- String
- Throws:
java.io.IOException
-
add
public java.lang.String add(byte[] content) throws java.io.IOException
Add byte array to IPFS- Parameters:
content
- A byte array to add at IPFS- Returns:
- String
- Throws:
java.io.IOException
-
get
public byte[] get(java.lang.String encodedHash) throws java.io.IOException
Get file from IPFS.- Parameters:
encodedHash
- A encoded multi hash string with base58.- Returns:
- byte[]
- Throws:
java.io.IOException
-
setIPFSNode
public void setIPFSNode(java.lang.String host, int port, boolean ssl)
Set a IPFS node.- Parameters:
host
- The host url.port
- The port number to use.ssl
- either using ssl or not.
-
-