@@ -61,11 +61,13 @@ final class Smart implements Content {
6161 /**
6262 * SmartJson object for convenient JSON parsing.
6363 */
64+
6465 private final transient SmartJson jsn ;
6566 /**
6667 * Public ctor.
6768 * @param cont Content
6869 */
70+
6971 public Smart (
7072 final Content cont ) {
7173 this .content = cont ;
@@ -76,6 +78,7 @@ public Smart(
7678 * @return Name of content
7779 * @throws IOException If there is any I/O problem
7880 */
81+
7982 public String name () throws IOException {
8083 return this .jsn .text ("name" );
8184 }
@@ -84,6 +87,7 @@ public String name() throws IOException {
8487 * @return Type of content
8588 * @throws IOException If there is any I/O problem
8689 */
90+
8791 public String type () throws IOException {
8892 return this .jsn .text ("type" );
8993 }
@@ -92,6 +96,7 @@ public String type() throws IOException {
9296 * @return Size content
9397 * @throws IOException If it fails
9498 */
99+
95100 public int size () throws IOException {
96101 return this .jsn .number ("size" );
97102 }
@@ -100,6 +105,7 @@ public int size() throws IOException {
100105 * @return Sha hash of content
101106 * @throws IOException If there is any I/O problem
102107 */
108+
103109 public String sha () throws IOException {
104110 return this .jsn .text ("sha" );
105111 }
@@ -108,6 +114,7 @@ public String sha() throws IOException {
108114 * @return URL of content
109115 * @throws IOException If there is any I/O problem
110116 */
117+
111118 public URL url () throws IOException {
112119 try {
113120 return new URI (this .jsn .text ("url" )).toURL ();
@@ -120,6 +127,7 @@ public URL url() throws IOException {
120127 * @return URL of content
121128 * @throws IOException If there is any I/O problem
122129 */
130+
123131 public URL htmlUrl () throws IOException {
124132 try {
125133 return new URI (this .jsn .text ("html_url" )).toURL ();
@@ -132,6 +140,7 @@ public URL htmlUrl() throws IOException {
132140 * @return URL of content
133141 * @throws IOException If there is any I/O problem
134142 */
143+
135144 public URL gitUrl () throws IOException {
136145 try {
137146 return new URI (this .jsn .text ("git_url" )).toURL ();
@@ -144,6 +153,7 @@ public URL gitUrl() throws IOException {
144153 * @return Base64 encoded content
145154 * @throws IOException If there is any I/O problem
146155 */
156+
147157 public String content () throws IOException {
148158 return this .jsn .text ("content" );
149159 }
@@ -152,29 +162,36 @@ public String content() throws IOException {
152162 * @return Decoded content
153163 * @throws IOException If there is any I/O problem
154164 */
165+
155166 public byte [] decoded () throws IOException {
156167 return DatatypeConverter .parseBase64Binary (this .content ());
157168 }
169+
158170 @ Override
159171 public int compareTo (final Content cont ) {
160172 return this .content .compareTo (cont );
161173 }
174+
162175 @ Override
163176 public void patch (final JsonObject json ) throws IOException {
164177 this .content .patch (json );
165178 }
179+
166180 @ Override
167181 public JsonObject json () throws IOException {
168182 return this .content .json ();
169183 }
184+
170185 @ Override
171186 public Repo repo () {
172187 return this .content .repo ();
173188 }
189+
174190 @ Override
175191 public String path () {
176192 return this .content .path ();
177193 }
194+
178195 @ Override
179196 public InputStream raw () throws IOException {
180197 return this .content .raw ();
0 commit comments