java.lang.Object
org.kohsuke.github.GHContent
- All Implemented Interfaces:
Refreshable
A Content of a repository.
- Author:
- Alexandre COLLIGNON
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDelete gh content update response.Delete gh content update response.Deprecated.URL to retrieve the raw content of the file.Deprecated.Useread()
Gets encoding.Gets git url.Gets html url.getName()
Gets name.getOwner()
Gets owner.getPath()
Gets path.getSha()
Gets sha.long
getSize()
Gets size.Gets target of a symlink.getType()
Gets type.getUrl()
Gets url.boolean
Is directory boolean.boolean
isFile()
Is file boolean.List immediate children of this directory.protected void
populate()
Fully populate the data by retrieving missing data.read()
Retrieves the actual bytes of the blob.void
refresh()
Fully populate the data by retrieving missing data.Update gh content update response.Update gh content update response.Update gh content update response.Update gh content update response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.kohsuke.github.Refreshable
refresh
-
Constructor Details
-
GHContent
public GHContent()Create default GHContent instance
-
-
Method Details
-
getOwner
Gets owner.- Returns:
- the owner
-
getType
Gets type.- Returns:
- the type
-
getEncoding
Gets encoding.- Returns:
- the encoding
-
getSize
public long getSize()Gets size.- Returns:
- the size
-
getSha
Gets sha.- Returns:
- the sha
-
getName
Gets name.- Returns:
- the name
-
getPath
Gets path.- Returns:
- the path
-
getTarget
Gets target of a symlink. This will only be set if"symlink".equals(getType())
- Returns:
- the target
-
getContent
Deprecated.Useread()
Retrieve the decoded content that is stored at this location.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.
- Returns:
- the content
- Throws:
IOException
- the io exception
-
getEncodedContent
Deprecated.Useread()
Retrieve the base64-encoded content that is stored at this location.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.
- Returns:
- the encoded content
- Throws:
IOException
- the io exception
-
getUrl
Gets url.- Returns:
- the url
-
getGitUrl
Gets git url.- Returns:
- the git url
-
getHtmlUrl
Gets html url.- Returns:
- the html url
-
read
Retrieves the actual bytes of the blob.- Returns:
- the input stream
- Throws:
IOException
- the io exception
-
getDownloadUrl
URL to retrieve the raw content of the file. Null if this is a directory.- Returns:
- the download url
- Throws:
IOException
- the io exception
-
isFile
public boolean isFile()Is file boolean.- Returns:
- the boolean
-
isDirectory
public boolean isDirectory()Is directory boolean.- Returns:
- the boolean
-
populate
Fully populate the data by retrieving missing data.Depending on the original API call where this object is created, it may not contain everything.
- Throws:
IOException
- the io exception
-
listDirectoryContent
List immediate children of this directory.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
update
Update gh content update response.- Parameters:
newContent
- the new contentcommitMessage
- the commit message- Returns:
- the gh content update response
- Throws:
IOException
- the io exception
-
update
public GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException Update gh content update response.- Parameters:
newContent
- the new contentcommitMessage
- the commit messagebranch
- the branch- Returns:
- the gh content update response
- Throws:
IOException
- the io exception
-
update
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage) throws IOException Update gh content update response.- Parameters:
newContentBytes
- the new content bytescommitMessage
- the commit message- Returns:
- the gh content update response
- Throws:
IOException
- the io exception
-
update
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch) throws IOException Update gh content update response.- Parameters:
newContentBytes
- the new content bytescommitMessage
- the commit messagebranch
- the branch- Returns:
- the gh content update response
- Throws:
IOException
- the io exception
-
delete
Delete gh content update response.- Parameters:
message
- the message- Returns:
- the gh content update response
- Throws:
IOException
- the io exception
-
delete
Delete gh content update response.- Parameters:
commitMessage
- the commit messagebranch
- the branch- Returns:
- the gh content update response
- Throws:
IOException
- the io exception
-
refresh
Fully populate the data by retrieving missing data. Depending on the original API call where this object is created, it may not contain everything.- Specified by:
refresh
in interfaceRefreshable
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
read()