Skip to content

Instantly share code, notes, and snippets.

View rafaeltoledo's full-sized avatar

Rafael Toledo rafaeltoledo

View GitHub Profile
@rafaeltoledo
rafaeltoledo / Base64.java
Created May 11, 2015 14:17
Convert Image to Base64
public static String encodeBase64(String path) {
try {
File file = new File(path);
FileInputStream imageInFile = new FileInputStream(file);
byte imageData[] = new byte[(int) file.length()];
imageInFile.read(imageData);
imageInFile.close();
return Base64.encodeToString(imageData, Base64.DEFAULT);
} catch (Exception e) {
apply plugin: 'checkstyle'
check.dependsOn 'checkstyle'
task checkstyle(type: Checkstyle) {
configFile file("$project.rootDir/config/checkstyle/checkstyle.xml")
source 'src'
include '**/*.java'
classpath = files()
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="GenericWhitespace" />
</module>
package net.rafaeltoledo.codequality;
import android.support.v7.app.AppCompatActivity;
import java.util.List;
public class MyActivity extends AppCompatActivity {
List< String > myList;
}
Executing external task ‘checkstyle’…
Parallel execution is an incubating feature.
[ant:checkstyle] [...]MyActivity.java:9:10: ‘<’ é seguido de espaço em branco.
[ant:checkstyle] [...]MyActivity.java:9:17: ‘>’ é precedido por espaço em branco.
:app:checkstyle FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ‘:app:checkstyle’.
List<String> myList;
Executing external task ‘checkstyle’…
Parallel execution is an incubating feature.
:app:checkstyle
BUILD SUCCESSFUL
Total time: 2.622 secs
apply plugin: 'findbugs'