public class GHContent extends Object implements Refreshable
GHRepository#getFileContent(String)| Constructor and Description |
|---|
GHContent() |
| Modifier and Type | Method and Description |
|---|---|
GHContentUpdateResponse |
delete(String message)
Delete gh content update response.
|
GHContentUpdateResponse |
delete(String commitMessage,
String branch)
Delete gh content update response.
|
String |
getContent()
Deprecated.
Use
read() |
String |
getDownloadUrl()
URL to retrieve the raw content of the file.
|
String |
getEncodedContent()
Deprecated.
Use
read() |
String |
getEncoding()
Gets encoding.
|
String |
getGitUrl()
Gets git url.
|
String |
getHtmlUrl()
Gets html url.
|
String |
getName()
Gets name.
|
GHRepository |
getOwner()
Gets owner.
|
String |
getPath()
Gets path.
|
String |
getSha()
Gets sha.
|
long |
getSize()
Gets size.
|
String |
getType()
Gets type.
|
String |
getUrl()
Gets url.
|
boolean |
isDirectory()
Is directory boolean.
|
boolean |
isFile()
Is file boolean.
|
PagedIterable<GHContent> |
listDirectoryContent()
List immediate children of this directory.
|
protected void |
populate()
Fully populate the data by retrieving missing data.
|
InputStream |
read()
Retrieves the actual bytes of the blob.
|
void |
refresh()
Fully populate the data by retrieving missing data.
|
GHContentUpdateResponse |
update(byte[] newContentBytes,
String commitMessage)
Update gh content update response.
|
GHContentUpdateResponse |
update(byte[] newContentBytes,
String commitMessage,
String branch)
Update gh content update response.
|
GHContentUpdateResponse |
update(String newContent,
String commitMessage)
Update gh content update response.
|
GHContentUpdateResponse |
update(String newContent,
String commitMessage,
String branch)
Update gh content update response.
|
static GHContent[] |
wrap(GHContent[] contents,
GHRepository repository)
Wrap gh content [ ].
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrefreshpublic GHRepository getOwner()
public String getType()
public String getEncoding()
public long getSize()
public String getSha()
public String getName()
public String getPath()
public String getContent() throws IOException
read()Due to the nature of GitHub's API, you're not guaranteed that the content will already be populated, so this may trigger network activity, and can throw an IOException.
IOException - the io exceptionpublic String getEncodedContent() throws IOException
read()Due to the nature of GitHub's API, you're not guaranteed that the content will already be populated, so this may trigger network activity, and can throw an IOException.
IOException - the io exceptionpublic String getUrl()
public String getGitUrl()
public String getHtmlUrl()
public InputStream read() throws IOException
IOException - the io exceptionpublic String getDownloadUrl() throws IOException
IOException - the io exceptionpublic boolean isFile()
public boolean isDirectory()
protected void populate()
throws IOException
Depending on the original API call where this object is created, it may not contain everything.
IOException - the io exceptionpublic PagedIterable<GHContent> listDirectoryContent() throws IOException
IOException - the io exceptionpublic GHContentUpdateResponse update(String newContent, String commitMessage) throws IOException
newContent - the new contentcommitMessage - the commit messageIOException - the io exceptionpublic GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException
newContent - the new contentcommitMessage - the commit messagebranch - the branchIOException - the io exceptionpublic GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage) throws IOException
newContentBytes - the new content bytescommitMessage - the commit messageIOException - the io exceptionpublic GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch) throws IOException
newContentBytes - the new content bytescommitMessage - the commit messagebranch - the branchIOException - the io exceptionpublic GHContentUpdateResponse delete(String message) throws IOException
message - the messageIOException - the io exceptionpublic GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException
commitMessage - the commit messagebranch - the branchIOException - the io exceptionpublic static GHContent[] wrap(GHContent[] contents, GHRepository repository)
contents - the contentsrepository - the repositorypublic void refresh()
throws IOException
refresh in interface RefreshableIOException - the io exceptionCopyright © 2020. All rights reserved.