diff --git a/java/samples/FileReaderAndWriter/Text.txt b/java/samples/FileReaderAndWriter/Text.txt new file mode 100644 index 0000000..c43cf9e --- /dev/null +++ b/java/samples/FileReaderAndWriter/Text.txt @@ -0,0 +1,5 @@ +Hello world!Hello world! +Hello world! +Hello world! +Hello world! +Hello world! \ No newline at end of file diff --git a/java/samples/FileReaderAndWriter/build.xml b/java/samples/FileReaderAndWriter/build.xml new file mode 100644 index 0000000..803ce41 --- /dev/null +++ b/java/samples/FileReaderAndWriter/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project FileReaderAndWriter. + + + diff --git a/java/samples/FileReaderAndWriter/build/classes/.netbeans_automatic_build b/java/samples/FileReaderAndWriter/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/java/samples/FileReaderAndWriter/build/classes/.netbeans_update_resources b/java/samples/FileReaderAndWriter/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/java/samples/FileReaderAndWriter/build/classes/filereaderandwriter/FileReaderAndWriter.class b/java/samples/FileReaderAndWriter/build/classes/filereaderandwriter/FileReaderAndWriter.class new file mode 100644 index 0000000..fdd4099 Binary files /dev/null and b/java/samples/FileReaderAndWriter/build/classes/filereaderandwriter/FileReaderAndWriter.class differ diff --git a/java/samples/FileReaderAndWriter/manifest.mf b/java/samples/FileReaderAndWriter/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/java/samples/FileReaderAndWriter/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/java/samples/FileReaderAndWriter/nbproject/build-impl.xml b/java/samples/FileReaderAndWriter/nbproject/build-impl.xml new file mode 100644 index 0000000..3236024 --- /dev/null +++ b/java/samples/FileReaderAndWriter/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/samples/FileReaderAndWriter/nbproject/genfiles.properties b/java/samples/FileReaderAndWriter/nbproject/genfiles.properties new file mode 100644 index 0000000..a87e5f8 --- /dev/null +++ b/java/samples/FileReaderAndWriter/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=64ca7b4c +build.xml.script.CRC32=2cd2026b +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=64ca7b4c +nbproject/build-impl.xml.script.CRC32=38645af4 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/java/samples/FileReaderAndWriter/nbproject/private/private.properties b/java/samples/FileReaderAndWriter/nbproject/private/private.properties new file mode 100644 index 0000000..11ff3b8 --- /dev/null +++ b/java/samples/FileReaderAndWriter/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/java/samples/FileReaderAndWriter/nbproject/project.properties b/java/samples/FileReaderAndWriter/nbproject/project.properties new file mode 100644 index 0000000..abdbcc9 --- /dev/null +++ b/java/samples/FileReaderAndWriter/nbproject/project.properties @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# \u0424\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 build.classes.dir, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/FileReaderAndWriter.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=filereaderandwriter.FileReaderAndWriter +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/java/samples/FileReaderAndWriter/nbproject/project.xml b/java/samples/FileReaderAndWriter/nbproject/project.xml new file mode 100644 index 0000000..db9f317 --- /dev/null +++ b/java/samples/FileReaderAndWriter/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + FileReaderAndWriter + + + + + + + + + diff --git a/java/samples/FileReaderAndWriter/src/filereaderandwriter/FileReaderAndWriter.java b/java/samples/FileReaderAndWriter/src/filereaderandwriter/FileReaderAndWriter.java new file mode 100644 index 0000000..654622e --- /dev/null +++ b/java/samples/FileReaderAndWriter/src/filereaderandwriter/FileReaderAndWriter.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package filereaderandwriter; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author denis + */ +public class FileReaderAndWriter { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + File file = new File("Text.txt"); + if(!file.exists()) try { + file.createNewFile(); + } catch (IOException ex) { + Logger.getLogger(FileReaderAndWriter.class.getName()).log(Level.SEVERE, null, ex); + } + + if(file.canWrite()){ + + String line = "Hello world!"; + try (FileWriter writer = new FileWriter(file, true)) { + writer.append("\n" + line); + } catch (IOException ex) { + Logger.getLogger(FileReaderAndWriter.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + if(file.canRead()){ + String line = ""; + try(FileReader reader = new FileReader(file)){ + + char[]buf = new char[5]; + int c =0; + while((c=reader.read(buf))!=-1){ + line += new String(buf, 0, c); + } + + }catch (IOException ex) { + Logger.getLogger(FileReaderAndWriter.class.getName()).log(Level.SEVERE, null, ex); + } + System.out.println(line); + } + } + +} diff --git a/java/samples/PropertiesExample/build.xml b/java/samples/PropertiesExample/build.xml new file mode 100644 index 0000000..2755765 --- /dev/null +++ b/java/samples/PropertiesExample/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project PropertiesExample. + + + diff --git a/java/samples/PropertiesExample/build/classes/.netbeans_automatic_build b/java/samples/PropertiesExample/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/java/samples/PropertiesExample/build/classes/.netbeans_update_resources b/java/samples/PropertiesExample/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/java/samples/PropertiesExample/build/classes/propertiesexample/PropertiesExample.class b/java/samples/PropertiesExample/build/classes/propertiesexample/PropertiesExample.class new file mode 100644 index 0000000..b724eb3 Binary files /dev/null and b/java/samples/PropertiesExample/build/classes/propertiesexample/PropertiesExample.class differ diff --git a/java/samples/PropertiesExample/manifest.mf b/java/samples/PropertiesExample/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/java/samples/PropertiesExample/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/java/samples/PropertiesExample/nbproject/build-impl.xml b/java/samples/PropertiesExample/nbproject/build-impl.xml new file mode 100644 index 0000000..53273d4 --- /dev/null +++ b/java/samples/PropertiesExample/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/samples/PropertiesExample/nbproject/genfiles.properties b/java/samples/PropertiesExample/nbproject/genfiles.properties new file mode 100644 index 0000000..a66821c --- /dev/null +++ b/java/samples/PropertiesExample/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=114678dd +build.xml.script.CRC32=5efee7cf +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=114678dd +nbproject/build-impl.xml.script.CRC32=6b3fab86 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/java/samples/PropertiesExample/nbproject/private/private.properties b/java/samples/PropertiesExample/nbproject/private/private.properties new file mode 100644 index 0000000..11ff3b8 --- /dev/null +++ b/java/samples/PropertiesExample/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/java/samples/PropertiesExample/nbproject/project.properties b/java/samples/PropertiesExample/nbproject/project.properties new file mode 100644 index 0000000..e3fea1a --- /dev/null +++ b/java/samples/PropertiesExample/nbproject/project.properties @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# \u0424\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 build.classes.dir, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/PropertiesExample.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=propertiesexample.PropertiesExample +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/java/samples/PropertiesExample/nbproject/project.xml b/java/samples/PropertiesExample/nbproject/project.xml new file mode 100644 index 0000000..81b1bb1 --- /dev/null +++ b/java/samples/PropertiesExample/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + PropertiesExample + + + + + + + + + diff --git a/java/samples/PropertiesExample/prop.properties b/java/samples/PropertiesExample/prop.properties new file mode 100644 index 0000000..3c27726 --- /dev/null +++ b/java/samples/PropertiesExample/prop.properties @@ -0,0 +1,3 @@ +#Wed Nov 23 21:13:48 MSK 2022 +nameK=Hello world +key=key value2 diff --git a/java/samples/PropertiesExample/src/propertiesexample/PropertiesExample.java b/java/samples/PropertiesExample/src/propertiesexample/PropertiesExample.java new file mode 100644 index 0000000..d35140f --- /dev/null +++ b/java/samples/PropertiesExample/src/propertiesexample/PropertiesExample.java @@ -0,0 +1,57 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package propertiesexample; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author denis + */ +public class PropertiesExample { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + File fileProp = new File("prop.properties"); + if(!fileProp.exists()) try { + fileProp.createNewFile(); + } catch (IOException ex) { + Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex); + } + + Properties properties = new Properties(); + try { + properties.load(new FileReader(fileProp)); + } catch (FileNotFoundException ex) { + Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex); + } + +// properties.put("key", "key value"); +// properties.put("key", "key value2"); +// properties.put("key2", "key value2"); + + System.out.println(properties.getProperty("nameK", "Key is not exist")); + + try { + properties.store(new FileWriter(fileProp), null); + } catch (IOException ex) { + Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex); + } + + } + +} diff --git a/java/samples/RulesPECS/build.xml b/java/samples/RulesPECS/build.xml new file mode 100644 index 0000000..1f2dc1c --- /dev/null +++ b/java/samples/RulesPECS/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project RulesPECS. + + + diff --git a/java/samples/RulesPECS/build/classes/.netbeans_automatic_build b/java/samples/RulesPECS/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/java/samples/RulesPECS/build/classes/.netbeans_update_resources b/java/samples/RulesPECS/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/java/samples/RulesPECS/build/classes/rulespecs/City.class b/java/samples/RulesPECS/build/classes/rulespecs/City.class new file mode 100644 index 0000000..d0e229d Binary files /dev/null and b/java/samples/RulesPECS/build/classes/rulespecs/City.class differ diff --git a/java/samples/RulesPECS/build/classes/rulespecs/Country.class b/java/samples/RulesPECS/build/classes/rulespecs/Country.class new file mode 100644 index 0000000..13bce0f Binary files /dev/null and b/java/samples/RulesPECS/build/classes/rulespecs/Country.class differ diff --git a/java/samples/RulesPECS/build/classes/rulespecs/District.class b/java/samples/RulesPECS/build/classes/rulespecs/District.class new file mode 100644 index 0000000..77eff4d Binary files /dev/null and b/java/samples/RulesPECS/build/classes/rulespecs/District.class differ diff --git a/java/samples/RulesPECS/build/classes/rulespecs/RulesPECS.class b/java/samples/RulesPECS/build/classes/rulespecs/RulesPECS.class new file mode 100644 index 0000000..0f074ad Binary files /dev/null and b/java/samples/RulesPECS/build/classes/rulespecs/RulesPECS.class differ diff --git a/java/samples/RulesPECS/build/classes/rulespecs/Street.class b/java/samples/RulesPECS/build/classes/rulespecs/Street.class new file mode 100644 index 0000000..55547c2 Binary files /dev/null and b/java/samples/RulesPECS/build/classes/rulespecs/Street.class differ diff --git a/java/samples/RulesPECS/manifest.mf b/java/samples/RulesPECS/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/java/samples/RulesPECS/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/java/samples/RulesPECS/nbproject/build-impl.xml b/java/samples/RulesPECS/nbproject/build-impl.xml new file mode 100644 index 0000000..daa47fa --- /dev/null +++ b/java/samples/RulesPECS/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/samples/RulesPECS/nbproject/genfiles.properties b/java/samples/RulesPECS/nbproject/genfiles.properties new file mode 100644 index 0000000..ebce509 --- /dev/null +++ b/java/samples/RulesPECS/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=f1c33432 +build.xml.script.CRC32=9cbcce91 +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=f1c33432 +nbproject/build-impl.xml.script.CRC32=01d0e4a4 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/java/samples/RulesPECS/nbproject/private/private.properties b/java/samples/RulesPECS/nbproject/private/private.properties new file mode 100644 index 0000000..11ff3b8 --- /dev/null +++ b/java/samples/RulesPECS/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/java/samples/RulesPECS/nbproject/project.properties b/java/samples/RulesPECS/nbproject/project.properties new file mode 100644 index 0000000..c5f6daf --- /dev/null +++ b/java/samples/RulesPECS/nbproject/project.properties @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# \u0424\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 build.classes.dir, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/RulesPECS.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=rulespecs.RulesPECS +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/java/samples/RulesPECS/nbproject/project.xml b/java/samples/RulesPECS/nbproject/project.xml new file mode 100644 index 0000000..65e52b8 --- /dev/null +++ b/java/samples/RulesPECS/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + RulesPECS + + + + + + + + + diff --git a/java/samples/RulesPECS/src/rulespecs/City.java b/java/samples/RulesPECS/src/rulespecs/City.java new file mode 100644 index 0000000..ed78e8b --- /dev/null +++ b/java/samples/RulesPECS/src/rulespecs/City.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package rulespecs; + +/** + * + * @author denis + */ +public class City extends Country{ + +} diff --git a/java/samples/RulesPECS/src/rulespecs/Country.java b/java/samples/RulesPECS/src/rulespecs/Country.java new file mode 100644 index 0000000..49421e1 --- /dev/null +++ b/java/samples/RulesPECS/src/rulespecs/Country.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package rulespecs; + +/** + * + * @author denis + */ +public class Country { + +} diff --git a/java/samples/RulesPECS/src/rulespecs/District.java b/java/samples/RulesPECS/src/rulespecs/District.java new file mode 100644 index 0000000..a82bf62 --- /dev/null +++ b/java/samples/RulesPECS/src/rulespecs/District.java @@ -0,0 +1,17 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package rulespecs; + +/** + * + * @author denis + */ +public class District extends City{ + + public void methods(){ + + } +} diff --git a/java/samples/RulesPECS/src/rulespecs/RulesPECS.java b/java/samples/RulesPECS/src/rulespecs/RulesPECS.java new file mode 100644 index 0000000..cfeaca7 --- /dev/null +++ b/java/samples/RulesPECS/src/rulespecs/RulesPECS.java @@ -0,0 +1,62 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package rulespecs; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author denis + */ +public class RulesPECS { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + RulesPECS rules = new RulesPECS(); + + List countrys = new ArrayList<>(); + countrys.add(new Country()); + List citys = new ArrayList<>(); + citys.add(new City()); + List districts = new ArrayList<>(); + districts.add(new District()); + List streets = new ArrayList<>(); + streets.add(new Street()); + + rules.producer(countrys); + rules.producer(citys); + rules.producer(districts); + rules.producer(streets); + + rules.consumer(countrys); + rules.consumer(citys); + rules.consumer(districts); + rules.consumer(streets); + } + + public void producer (List list){ + list.add(new Country()); + list.add(new City()); + list.add(new District()); + list.add(new Street()); + } + + public void consumer (List list){ + Object district = list.get(0); + if(district instanceof Country) System.out.println("Object is Country"); + if(district instanceof City) System.out.println("Object is City"); + if(district instanceof District) System.out.println("Object is District"); + if(district instanceof Street) System.out.println("Object is Street"); + list.add(new Country()); + list.add(new City()); + list.add(new District()); + list.add(new Street()); + } + +} diff --git a/java/samples/RulesPECS/src/rulespecs/Street.java b/java/samples/RulesPECS/src/rulespecs/Street.java new file mode 100644 index 0000000..53a068e --- /dev/null +++ b/java/samples/RulesPECS/src/rulespecs/Street.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package rulespecs; + +/** + * + * @author denis + */ +public class Street extends District{ + +}