Skip to content

Instantly share code, notes, and snippets.

@AnnaBoro
AnnaBoro / DemoStream2.java
Last active February 27, 2016 20:07
InputStream
package lesson8.stream;
import java.io.*;
public class DemoStream2 {
public static void main (String[] args) {
InputStream inputStream = null;
@AnnaBoro
AnnaBoro / DemoFile.java
Created February 27, 2016 19:14
+ copy file
package lesson8.file;
import java.io.*;
public class DemoFile {
public static void main(String[] args) {
@AnnaBoro
AnnaBoro / DemoFile.java
Created February 26, 2016 21:26
create file + get directory tree
package lesson8.file;
import java.io.File;
public class DemoFile {
public static void main(String[] args) {
createFile();
package lesson8.stream;
import java.io.ByteArrayInputStream;
public class DemoStream {
public static void main (String[] args) {
DemoStream demoStream = new DemoStream();
@AnnaBoro
AnnaBoro / Reflection2Test.java
Last active February 21, 2016 21:08
setPrivatesTest
package junittests;
import static org.junit.Assert.*;
import lesson7_10.reflection.Bird;
import lesson7_10.reflection.Reflection2;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@AnnaBoro
AnnaBoro / Reflection2Test.java
Created February 21, 2016 20:34
test initClass with consructor
package junittests;
import static org.junit.Assert.*;
import lesson7_10.reflection.Bird;
import lesson7_10.reflection.Reflection2;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@AnnaBoro
AnnaBoro / ApplicationManager.java
Created February 15, 2016 15:21
+ getService
package lesson7_10.reflection;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class ApplicationManager<T> {
public void runManager(Class sclass) throws IllegalAccessException, InstantiationException, InvocationTargetException {
@AnnaBoro
AnnaBoro / ApplicationManager.java
Created February 13, 2016 17:00
@initService
package lesson7_10.reflection;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class ApplicationManager {
public void runManager(Class sclass) throws IllegalAccessException, InstantiationException, InvocationTargetException {
package lesson7_10.reflection;
import java.lang.annotation.Annotation;
public class ApplicationManager {
public void runManager(Class sclass) {
Annotation[] annotations = sclass.getAnnotations();
package lesson7_10.reflection;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Service {