If the `keys` list for the identified file is an empty `KeyList`, then this message MUST NOT set any field except `expirationTime`. #### Signature Requirements Every `Key` in the `keys` list for the identified file MUST sign this transaction, if any field other than `expirationTime` is to be updated.
If the `keys` list for the identified file is an empty `KeyList` (because this file was previously created or updated to have an empty `KeyList`), then the file is considered immutable and this message MUST NOT set any field except `expirationTime`.
See the [File Service](#FileService) specification for a detailed explanation of the signature requirements for all file transactions. ### Block Stream Effects None See Hedera Documentation
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Transaction
Transaction.SignableNodeTransactionBodyBytesNested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Executable
Executable.GrpcRequest -
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.Transaction
customFeeLimits, DEFAULT_AUTO_RENEW_PERIOD, defaultMaxTransactionFee, DUMMY_ACCOUNT_ID, DUMMY_TRANSACTION_ID, frozenBodyBuilder, innerSignedTransactions, outerTransactions, publicKeys, regenerateTransactionId, signers, sigPairLists, sourceTransactionBody, transactionIdsFields inherited from class com.hedera.hashgraph.sdk.Executable
attemptedAllNodes, blockingUnaryCall, grpcDeadline, logger, maxAttempts, maxBackoff, minBackoff, nodeAccountIds, nodes, random, RST_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.FileUpdateTransaction(TransactionBody txBody) Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) FileUpdateTransactionBody.Builderbuild()Build the correct transaction body.Remove the file memo.com.google.protobuf.ByteStringExtract the files contents as a byte string.Extract the expiration time.Extract the file id.Extract the file's memo up to 100 bytes.getKeys()Get the keys which must sign any transactions modifying this file.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.(package private) voidInitialize from the transaction body.(package private) voidonFreeze(TransactionBody.Builder bodyBuilder) Called inTransaction.freezeWith(Client)just before the transaction body is built.(package private) voidonScheduled(SchedulableTransactionBody.Builder scheduled) Called inTransaction.schedule()when converting transaction into a scheduled version.setContents(byte[] bytes) If set, replace contents of the file identified bysetFileId(FileId)with the given bytes.setContents(String text) If set, encode the givenStringas UTF-8 and replace the contents of the file identified bysetFileId(FileId).setExpirationTime(Duration expirationTime) setExpirationTime(Instant expirationTime) An expiration timestamp.Set the ID of the file to update; required.setFileMemo(String memo) A short description of this file.The new list of keys that "own" this file.(package private) voidvalidateChecksums(Client client) Methods inherited from class com.hedera.hashgraph.sdk.Transaction
addSignature, addSignature, batchify, buildAllTransactions, buildTransaction, doSchedule, estimateFee, freeze, freezeWith, fromBytes, fromScheduledTransaction, generateTransactionIds, getBatchKey, getDefaultMaxTransactionFee, getExecutionState, getHighVolume, getMaxTransactionFee, getRegenerateTransactionId, getRequiredChunks, getSignableNodeBodyBytesList, getSignatures, getSignaturesAtOffset, getTransactionBodySize, getTransactionHash, getTransactionHashPerNode, getTransactionId, getTransactionIdInternal, getTransactionMemo, getTransactionSize, getTransactionValidDuration, hash, isBatchedAndNotBatchTransaction, isFrozen, keyAlreadySigned, makeRequest, mapResponse, mapResponseStatus, onExecute, onExecuteAsync, regenerateTransactionId, requireNotFrozen, requireOneNodeAccountId, schedule, setBatchKey, setHighVolume, setMaxTransactionFee, setNodeAccountIds, setRegenerateTransactionId, setTransactionId, setTransactionMemo, setTransactionValidDuration, sign, signTransaction, signWith, signWithOperator, spawnBodyBuilder, toBytes, toString, wipeTransactionListsMethods inherited from class com.hedera.hashgraph.sdk.Executable
advanceRequest, checkNodeAccountIds, execute, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getGrpcRequest, getMaxAttempts, getMaxBackoff, getMaxRetry, getMinBackoff, getNodeAccountIds, getNodeForExecute, grpcDeadline, logTransaction, mergeFromClient, setGrpcDeadline, setLogger, setMaxAttempts, setMaxBackoff, setMaxRetry, setMinBackoff, setNodesFromNodeAccountIds, setRequestListener, setResponseListener, shouldRetryExceptionally
-
Constructor Details
-
FileUpdateTransaction
public FileUpdateTransaction()Constructor. -
FileUpdateTransaction
FileUpdateTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, throws com.google.protobuf.InvalidProtocolBufferExceptionTransaction>> txs) Constructor.- Parameters:
txs- Compound list of transaction id's list of (AccountId, Transaction) records- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
FileUpdateTransaction
FileUpdateTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getFileId
Extract the file id.- Returns:
- the file id
-
setFileId
Set the ID of the file to update; required.- Parameters:
fileId- the ID of the file to update.- Returns:
this
-
getKeys
Get the keys which must sign any transactions modifying this file.- Returns:
- the list of keys
-
setKeys
The new list of keys that "own" this file.If set, every key in this `KeyList` MUST sign this transaction.
If set, every key in the _previous_ `KeyList` MUST _also_ sign this transaction.
If this value is an empty `KeyList`, then the file SHALL be immutable after completion of this transaction.- Parameters:
keys- The Key or Keys to be set- Returns:
this
-
getExpirationTime
Extract the expiration time.- Returns:
- the expiration time
-
setExpirationTime
An expiration timestamp.If set, this value MUST be strictly later than the existing `expirationTime` value, or else it will be ignored.
If set, this value SHALL replace the existing `expirationTime`.
If this field is the only field set, then this transaction SHALL NOT require any signature other than the `payer` for the transaction.
When the network consensus time exceeds the then-current `expirationTime`, the network SHALL expire the file.- Parameters:
expirationTime- the newInstantat which the transaction will expire.- Returns:
this
-
setExpirationTime
-
getContents
public com.google.protobuf.ByteString getContents()Extract the files contents as a byte string.- Returns:
- the files contents as a byte string
-
setContents
If set, replace contents of the file identified bysetFileId(FileId)with the given bytes.If the contents of the file are longer than the given byte array, then the file will be truncated.
Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the network; if you exceed this you may receive a
Status.TRANSACTION_OVERSIZE.In this case, you will need to keep the initial file contents under ~6KiB and then use
FileAppendTransaction, which automatically breaks the contents into chunks for you, to append contents of arbitrary size.- Parameters:
bytes- the bytes to replace the contents of the file with.- Returns:
this- See Also:
-
setContents
If set, encode the givenStringas UTF-8 and replace the contents of the file identified bysetFileId(FileId).If the contents of the file are longer than the UTF-8 encoding of the given string, then the file will be truncated.
The string can later be recovered from
Executable.execute(Client)viaString(byte[], java.nio.charset.Charset)usingStandardCharsets.UTF_8.Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the network; if you exceed this you may receive a
Status.TRANSACTION_OVERSIZE.In this case, you will need to keep the initial file contents under ~6KiB and then use
FileAppendTransaction, which automatically breaks the contents into chunks for you, to append contents of arbitrary size.- Parameters:
text- the string to replace the contents of the file with.- Returns:
this- See Also:
-
getFileMemo
Extract the file's memo up to 100 bytes.- Returns:
- the file's memo up to 100 bytes
-
setFileMemo
A short description of this file.This value, if set, MUST NOT exceed `transaction.maxMemoUtf8Bytes` (default 100) bytes when encoded as UTF-8.
- Parameters:
memo- the file's memo- Returns:
this
-
clearMemo
Remove the file memo.- Returns:
this
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
build
Build the correct transaction body.- Returns:
builder
-
validateChecksums
- Specified by:
validateChecksumsin classTransaction<FileUpdateTransaction>- Throws:
BadEntityIdException
-
getMethodDescriptor
io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()Description copied from class:ExecutableCalled to direct the invocation of the query to the appropriate gRPC service.- Specified by:
getMethodDescriptorin classExecutable<FileUpdateTransaction,Transaction, TransactionResponse, TransactionResponse>
-
onFreeze
Description copied from class:TransactionCalled inTransaction.freezeWith(Client)just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.- Specified by:
onFreezein classTransaction<FileUpdateTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<FileUpdateTransaction>
-