File tree Expand file tree Collapse file tree
main/java/org/jooby/assets
test/java/org/jooby/assets Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -433,7 +433,8 @@ private static String spath(final String path) {
433433 return path .startsWith ("/" ) ? path : "/" + path ;
434434 }
435435
436- private static String humanReadableByteCount (final long bytes ) {
436+ // http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
437+ static String humanReadableByteCount (final long bytes ) {
437438 int unit = 1024 ;
438439 if (bytes < unit ) {
439440 return bytes + "b" ;
Original file line number Diff line number Diff line change @@ -180,6 +180,14 @@ public void pipeline() throws Exception {
180180 assertEquals (Collections .emptyList (), pipeline );
181181 }
182182
183+ @ Test
184+ public void humandReadableBytes () throws Exception {
185+ assertEquals ("1.0kb" , AssetCompiler .humanReadableByteCount (1024 ));
186+ assertEquals ("1.0mb" , AssetCompiler .humanReadableByteCount (1024 * 1024 ));
187+
188+ assertEquals ("100.0mb" , AssetCompiler .humanReadableByteCount (1024 * 1024 * 100 ));
189+ }
190+
183191 private String compile (final AssetCompiler compiler , final String path ) throws Exception {
184192 return new String (
185193 ByteStreams .toByteArray (compiler .build (asset (path )).stream ()), "UTF-8" );
Original file line number Diff line number Diff line change @@ -2261,7 +2261,7 @@ org.eclipse.jdt.apt.processorOptions/defaultOverwrite=true
22612261 <undertow .version>1.3.22.Final</undertow .version>
22622262 <servlet .version>3.1.0</servlet .version>
22632263 <jetty .version>9.3.8.v20160314</jetty .version>
2264- <netty .version>4.1.0.CR7 </netty .version>
2264+ <netty .version>4.1.0.Final </netty .version>
22652265 <javassist .version>3.20.0-GA</javassist .version>
22662266 <javax .ws.rs-api.version>2.0</javax .ws.rs-api.version>
22672267 <slf4j-api .version>1.7.7</slf4j-api .version>
You can’t perform that action at this time.
0 commit comments