java.lang.Object
com.hedera.hashgraph.sdk.FileId
- All Implemented Interfaces:
Comparable<FileId>
The ID for a file on Hedera.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FileIdThe public node address book for the current network.static final FileIdThe current exchange rate of HBAR to USD.static final FileIdThe current fee schedule for the network.final longThe id numberfinal longThe realm numberfinal longThe shard number -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanstatic FileIdfromBytes(byte[] bytes) Assign the file id from a byte array.static FileIdfromEvmAddress(long shard, long realm, String evmAddress) Constructs a FileId from shard, realm, and EVM address.(package private) static FileIdfromProtobuf(FileID fileId) Create a file id object from a protobuf.static FileIdfromSolidityAddress(String address) Deprecated.This method is deprecated.static FileIdfromString(String id) Assign the file id from a string.static FileIdgetAddressBookFileIdFor(long shard, long realm) Get the `FileId` of the Hedera address book for the given realm and shard.Extract the checksum.static FileIdgetExchangeRatesFileIdFor(long shard, long realm) Get the `FileId` of the Hedera exchange rates for the given realm and shard.static FileIdgetFeeScheduleFileIdFor(long shard, long realm) Get the `FileId` of the Hedera fee schedule for the given realm and shard.inthashCode()byte[]toBytes()Create the byte array.Converts this FileId to an EVM address string.(package private) FileIDDeprecated.This method is deprecated.toString()toStringWithChecksum(Client client) Convert the client to a string representation with a checksum.voidDeprecated.UsevalidateChecksum(Client)instead.voidvalidateChecksum(Client client) Validate that the client is configured correctly.
-
Field Details
-
ADDRESS_BOOK
The public node address book for the current network. -
FEE_SCHEDULE
The current fee schedule for the network. -
EXCHANGE_RATES
The current exchange rate of HBAR to USD. -
shard
@Nonnegative public final long shardThe shard number -
realm
@Nonnegative public final long realmThe realm number -
num
@Nonnegative public final long numThe id number
-
-
Constructor Details
-
FileId
Deprecated.Assign the num portion of the file id.- Parameters:
num- the num portion not negative Constructor that uses shard, realm and num should be used instead as shard and realm should not assume 0 value
-
FileId
public FileId(@Nonnegative long shard, @Nonnegative long realm, @Nonnegative long num) Assign the file id.- Parameters:
shard- the shard portionrealm- the realm portionnum- the num portion
-
FileId
FileId(@Nonnegative long shard, @Nonnegative long realm, @Nonnegative long num, @Nullable String checksum) Assign the file id and optional checksum.- Parameters:
shard- the shard portionrealm- the realm portionnum- the num portionchecksum- the optional checksum
-
-
Method Details
-
getAddressBookFileIdFor
Get the `FileId` of the Hedera address book for the given realm and shard.- Parameters:
shard-realm-- Returns:
- FileId
-
getFeeScheduleFileIdFor
Get the `FileId` of the Hedera fee schedule for the given realm and shard.- Parameters:
shard-realm-- Returns:
- FileId
-
getExchangeRatesFileIdFor
Get the `FileId` of the Hedera exchange rates for the given realm and shard.- Parameters:
shard-realm-- Returns:
- FileId
-
fromString
Assign the file id from a string.- Parameters:
id- the string representation of a file id- Returns:
- the file id object
-
fromBytes
public static FileId fromBytes(byte[] bytes) throws com.google.protobuf.InvalidProtocolBufferException Assign the file id from a byte array.- Parameters:
bytes- the byte array representation of a file id- Returns:
- the file id object
- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
fromProtobuf
Create a file id object from a protobuf.- Parameters:
fileId- the protobuf- Returns:
- the file id object
-
fromSolidityAddress
Deprecated.This method is deprecated. UsefromEvmAddress(long, long, String)instead.Retrieve the file id from a solidity address.- Parameters:
address- a string representing the address- Returns:
- the file id object
-
toSolidityAddress
Deprecated.This method is deprecated. UsetoEvmAddress()instead.Extract the solidity address.- Returns:
- the solidity address as a string
-
fromEvmAddress
Constructs a FileId from shard, realm, and EVM address. The EVM address must be a "long zero address" (first 12 bytes are zero).- Parameters:
shard- the shard numberrealm- the realm numberevmAddress- the EVM address as a hex string- Returns:
- the FileId object
- Throws:
IllegalArgumentException- if the EVM address is not a valid long zero address
-
toEvmAddress
Converts this FileId to an EVM address string. Creates a solidity address using shard=0, realm=0, and the file number.- Returns:
- the EVM address as a hex string
-
toProtobuf
FileID toProtobuf()- Returns:
- protobuf representing the file id
-
validate
Deprecated.UsevalidateChecksum(Client)instead.- Parameters:
client- to validate against- Throws:
BadEntityIdException- if entity ID is formatted poorly
-
validateChecksum
Validate that the client is configured correctly.- Parameters:
client- the client to validate- Throws:
BadEntityIdException- if entity ID is formatted poorly
-
getChecksum
Extract the checksum.- Returns:
- the checksum
-
toBytes
public byte[] toBytes()Create the byte array.- Returns:
- byte array representation
-
toString
-
toStringWithChecksum
Convert the client to a string representation with a checksum.- Parameters:
client- the client to stringify- Returns:
- string representation with checksum
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<FileId>
-