- Profilo Linkedin: https://it.linkedin.com/in/marcovelluto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public byte[] getByteFromFile(File file) throws IOException, FileTooBigException { | |
| if (file.length() > MAX_FILE_SIZE) { | |
| throw new FileTooBigException(file); | |
| } | |
| ByteArrayOutputStream ous = null; | |
| InputStream ios = null; | |
| try { | |
| byte[] buffer = new byte[4096]; | |
| ous = new ByteArrayOutputStream(); | |
| ios = new FileInputStream(file); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void moveFile () throws IOException { | |
| File afile =new File(PDF_NAME_DIRECTORY); | |
| if(afile.renameTo(new File("C:\\dati\\newDirectory\\" + afile.getName()))){ | |
| System.out.println("File is moved successful!"); | |
| }else{ | |
| System.out.println("File is failed to move!"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Color; | |
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.net.MalformedURLException; | |
| import java.sql.SQLException; | |
| import java.util.ArrayList; | |
| import java.util.Date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void readFileFromDisk (String path, String fileName){ | |
| try{ | |
| bufferReader = new BufferedReader(new FileReader("C:\\dati\\fileDiTest.txt")); | |
| StringBuilder sb = new StringBuilder(); | |
| String line = bufferReader.readLine(); | |
| while (line != null) { | |
| sb.append(line); | |
| sb.append(System.lineSeparator()); | |
| line = bufferReader.readLine(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void writeFileOnDisk (String path, String fileName, String csn){ | |
| try{ | |
| PrintWriter write = new PrintWriter(path + fileName, csn); | |
| write.println("The first line"); | |
| write.close(); | |
| } catch (IOException ex) { | |
| log.error("Error in writeFileOnDisk", ex); | |
| } finally { | |
| if(write != null) | |
| write.close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.replaceAll = function (find, replace) { | |
| var str = this; | |
| return str.replace(new RegExp(find, 'g'), replace); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Bubble Sort with Generics | |
| */ | |
| public void bubbleSort () throws EmptyArrayException { | |
| for(int i=0; i < this.arraySort.length; i++) | |
| for (int j=0; j < this.arraySort.length - 1; j++) | |
| if(this.arraySort[j].compareTo(this.arraySort[j+1]) > 0) { | |
| T key = this.arraySort[j]; | |
| this.arraySort[j] = this.arraySort[j+1]; | |
| this.arraySort[j+1] = key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; | |
| [dateComponents setDay:11]; | |
| [dateComponents setMonth:05]; | |
| [dateComponents setYear:2014]; | |
| NSDate *date = [[NSDate alloc] init]; | |
| date = [dateComponents date]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <H2> HeaderDoc Tags Common to All Comment Types </H2> | |
| The tags in the table below can be used in any comment for any data type, function, header, or class. | |
| * @abstract -> A short string that briefly describes a function, data type, and so on. This should not contain multiple lines (because it will look odd in the mini-TOCs). Save the detailed descriptions for the discussion tag. | |
| usage in: block. (single short sentence recommended) | |
| * @apiuid -> Overrides the API UID (apple_ref) associated with this comment. | |
| Note that very little checking is performed on this string. Thus, this tag has the potential to seriously break your output if used incorrectly. It is primarily provided for resolving symbol collisions that are otherwise unavoidable, and is generally discouraged. | |
| usage in: attribute. Must contain no spaces, and must be a valid API reference. See “Symbol Markers for HTML-Based Documentation” for details. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @abstract -> Nome del metodo dal quale è stato estratto questo codice. | |
| @attention -> Warning relativi al metodo. | |
| @author -> Autore del metodo | |
| @brief -> Descrizione del metodo che apparire nella doc rapida. | |
| @bug -> Bug presenti attualmente nel codice. | |
| @code @\endcode | |
| @copyright -> Copyriht del codice | |
| @const -> Costanti che vengono utillizzate all'interno del metodo. | |
| @date -> Data creazione. | |
| @discussion -> |