Capitolo 14: Flussi. Capitolo 14. Flussi Apogeo srl Horstmann-Concetti di informatica e fondamenti di Java 2

Size: px
Start display at page:

Download "Capitolo 14: Flussi. Capitolo 14. Flussi. 2002 Apogeo srl Horstmann-Concetti di informatica e fondamenti di Java 2"

Transcription

1 Capitolo 14 Flussi 1

2 Figura 1 Una finestra di dialogo di tipojfilechooser 2

3 Figura 2 Il codice di Cesare 3

4 File Encryptor.java import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.inputstream; import java.io.outputstream; import java.io.ioexception; Un cifratore cifra file usando la crittografia di Cesare. Per la decifrazione, usate un cifratore con la chiave opposta a quella di cifratura. public class Encryptor Costruisce un akey la chiave di cifratura 4

5 public Encryptor(int akey) key = akey; Cifra il contenuto di un infile il file di outfile il file di uscita public void encryptfile(file infile, File outfile) throws IOException InputStream in = null; OutputStream out = null; 5

6 try in = new FileInputStream(inFile); out = new FileOutputStream(outFile); encryptstream(in, out); finally if (in!= null) in.close(); if (out!= null) out.close(); Cifra il contenuto di un in il flusso di out il flusso di uscita public void encryptstream(inputstream in, OutputStream out) throws IOException 6

7 boolean done = false; while (!done) int next = in.read(); if (next == -1) done = true; else byte b = (byte)next; byte c = encrypt(b); out.write(c); Cifra un b il byte da il byte cifrato 7

8 public byte encrypt(byte b) return (byte)(b + key); private int key; 8

9 File EncryptorTest.java import java.io.file; import java.io.ioexception; import javax.swing.jfilechooser; import javax.swing.joptionpane; Un programma per collaudare il cifratore con il codice di Cesare. public class EncryptorTest public static void main(string[] args) try JFileChooser chooser = new JFileChooser(); if (chooser.showopendialog(null)!= JFileChooser.APPROVE_OPTION) System.exit(0); 9

10 File infile = chooser.getselectedfile(); if (chooser.showsavedialog(null)!= JFileChooser.APPROVE_OPTION) System.exit(0); File outfile = chooser.getselectedfile(); String input = JOptionPane.showInputDialog("Key"); int key = Integer.parseInt(input); Encryptor crypt = new Encryptor(key); crypt.encryptfile(infile, outfile); catch (NumberFormatException exception) System.out.println("Key must be an integer: " + exception); catch (IOException exception) System.out.println("Error processing file: " + exception); System.exit(0); 10

11 Figura 3 Crittografia con chiave pubblica 11

12 File Crypt.java import java.io.file; import java.io.ioexception; Un programma che esegue il cifratore con il codice di Cesare usando gli argomenti forniti sulla riga comandi. public class Crypt public static void main(string[] args) boolean decrypt = false; int key = DEFAULT_KEY; File infile = null; File outfile = null; if (args.length < 2 args.length > 4) usage(); 12

13 try for (int i = 0; i < args.length; i++) if (args[i].charat(0) == '-') // è un opzione della riga comandi char option = args[i].charat(1); if (option == 'd') decrypt = true; else if (option == 'k') key = Integer.parseInt( args[i].substring(2)); 13

14 else // è il nome di un file if (infile == null) infile = new File(args[i]); else if (outfile == null) outfile = new File(args[i]); else usage(); if (decrypt) key = -key; Encryptor crypt = new Encryptor(key); crypt.encryptfile(infile, outfile); catch (NumberFormatException exception) System.out.println("Key must be an integer: " + exception); 14

15 catch (IOException exception) System.out.println("Error processing file: " + exception); Stampa un messaggio che descrive l uso corretto, poi termina il programma. public static void usage() System.out.println( "Usage: java Crypt [ d] [ kn] infile outfile"); System.exit(1); public static final int DEFAULT_KEY = 3; 15

16 File PurseTest.java import java.io.file; import java.io.ioexception; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.objectinputstream; import java.io.objectoutputstream; import javax.swing.joptionpane; Questo programma verifica la serializzazione di un oggetto di tipo Purse. Se esiste un file con dati serializzati di un borsellino, esso viene caricato; altrimenti il programma parte con un nuovo borsellino. Ulteriori monete vengono aggiunte al borsellino, quindi i dati del borsellino vengono memorizzati. 16

17 public class PurseTest public static void main(string[] args) throws IOException, ClassNotFoundException Purse mypurse; File f = new File("purse.dat"); if (f.esists()) ObjectInputStream in = new ObjectInputStream (new FileInputStream(f)); mypurse = (Purse)in.readObject(); in.close(); else mypurse = new Purse(); 17

18 // aggiungi monete al borsellino mypurse.add(new Coin(NICKEL_VALUE, "nickel")); mypurse.add(new Coin(DIME_VALUE, "dime")); mypurse.add(new Coin(QUARTER_VALUE, "quarter")); double totalvalue = mypurse.gettotal(); System.out.println("The total is " + totalvalue); ObjectOutputStream out = new ObjectOutputStream (new FileOutputStream(f)); out.writeobject(mypurse); out.close(); private static final double NICKEL_VALUE = 0.05; private static final double DIME_VALUE = 0.1; private static final double QUARTER_VALUE = 0.25; 18

19 Figura 4 Accesso sequenziale e casuale 19

20 File BankDataTest.java import java.io.ioexception; import java.io.randomaccessfile; import javax.swing.joptionpane; Questo programma collauda l accesso casuale. Potete accedere a conti esistenti ed aggiungervi gli interessi, oppure creare nuovi conti. I conti vengono memorizzati in un file ad accesso casuale. public class BankDataTest public static void main(string[] args) BankData data = new BankData(); try 20

21 data.open("bank.dat"); boolean done = false; while (!done) String input = JOptionPane.showInputDialog( "Account number or " + data.size() + " for new account"); if (input == null) done = true; else int pos = Integer.parseInt(input); if (0 <= pos && pos < data.size()) // aggiungi gli interessi 21

22 SavingsAccount account = data.read(pos); System.out.println("balance=" + account.getbalance() + ",interestrate=" + account.getinterestrate()); account.addinterest(); data.write(pos, account); else // aggiungi un conto input = JOptionPane.showInputDialog( "Balance"); double balance = Double.parseDouble(input); input = JOptionPane.showInputDialog( "Interest Rate"); double interestrate = Double.parseDouble(input); 22

23 SavingsAccount account = new SavingsAccount(interestRate); account.deposit(balance); data.write(data.size(), account); finally data.close(); System.exit(0); 23

24 File BankData.java import java.io.ioexception; import java.io.randomaccessfile; Questa classe funge da tramite per un file ad accesso casuale contenente i dati di conti di risparmio. public class BankData Costruisce un oggetto di tipo BankData senza associarlo ad un file. public BankData() file = null; 24

25 Apre il file dei filename il nome del file che contiene informazioni sui conti di risparmio public void open(string filename) throws IOException if (file!= null) file.close(); file = new RandomAccessFile(filename, "rw"); Restituisce il numero di conti presenti nel il numero di conti public int size() return (int)(file.length() / RECORD_SIZE); 25

26 Chiude il file dei dati. public void close() throws IOException if (file!= null) file.close(); file = null; Legge il record di un conto di n l indice del conto nel file dei un oggetto di tipo SavingsAccount inizializzato con i dati letti dal file public SavingsAccount read(int n) throws IOException 26

27 file.seek(n * RECORD_SIZE); double balance = file.readdouble(); double interestrate = file.readdouble(); SavingsAccount account = new SavingsAccount(interestRate); account.deposit(balance); return account; Scrive il record di un conto di risparmio nel file dei n l indice del conto nel file dei account il conto da scrivere 27

28 public void write(int n, SavingsAccount account) throws IOException file.seek(n * RECORD_SIZE); file.writedouble(account.getbalance()); file.writedouble(account.getinterestrate()); private RandomAccessFile file; public static final int DOUBLE_SIZE = 8; public static final int RECORD_SIZE = 2 * DOUBLE_SIZE; 28

D06 PROGRAMMING with JAVA

D06 PROGRAMMING with JAVA Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch16 Files and Streams PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com, for

More information

Chapter 20 Streams and Binary Input/Output. Big Java Early Objects by Cay Horstmann Copyright 2014 by John Wiley & Sons. All rights reserved.

Chapter 20 Streams and Binary Input/Output. Big Java Early Objects by Cay Horstmann Copyright 2014 by John Wiley & Sons. All rights reserved. Chapter 20 Streams and Binary Input/Output Big Java Early Objects by Cay Horstmann Copyright 2014 by John Wiley & Sons. All rights reserved. 20.1 Readers, Writers, and Streams Two ways to store data: Text

More information

COMP Tutorial #5 - Solution Files

COMP Tutorial #5 - Solution Files COMP 249 - Tutorial #5 - Solution Files Question 1: Are the following definitions correct? Discuss Why? 1. Text files are not convenient because they take more disk space than Binary files. Binary files

More information

FILE I/O IN JAVA. Prof. Chris Jermaine cmj4@cs.rice.edu. Prof. Scott Rixner rixner@cs.rice.edu

FILE I/O IN JAVA. Prof. Chris Jermaine cmj4@cs.rice.edu. Prof. Scott Rixner rixner@cs.rice.edu FILE I/O IN JAVA Prof. Chris Jermaine cmj4@cs.rice.edu Prof. Scott Rixner rixner@cs.rice.edu 1 Our Simple Java Programs So Far Aside from screen I/O......when they are done, they are gone They have no

More information

File I/O - Chapter 10. Many Stream Classes. Text Files vs Binary Files

File I/O - Chapter 10. Many Stream Classes. Text Files vs Binary Files File I/O - Chapter 10 A Java stream is a sequence of bytes. An InputStream can read from a file the console (System.in) a network socket an array of bytes in memory a StringBuffer a pipe, which is an OutputStream

More information

CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus

CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose This assignment exercises how to write a peer-to-peer communicating program using non-blocking

More information

public class neurale extends JFrame implements NeuralNetListener {

public class neurale extends JFrame implements NeuralNetListener { /* questo file contiene le funzioni che permettono la gestione della rete neurale. In particolare qui si implementa la fase di apprendimento e di addestramento. */ package neurofuzzy; import org.joone.engine.*;

More information

JAVA - FILES AND I/O

JAVA - FILES AND I/O http://www.tutorialspoint.com/java/java_files_io.htm JAVA - FILES AND I/O Copyright tutorialspoint.com The java.io package contains nearly every class you might ever need to perform input and output I/O

More information

Creating a Simple, Multithreaded Chat System with Java

Creating a Simple, Multithreaded Chat System with Java Creating a Simple, Multithreaded Chat System with Java Introduction by George Crawford III In this edition of Objective Viewpoint, you will learn how to develop a simple chat system. The program will demonstrate

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void

More information

CS 1302 Ch 19, Binary I/O

CS 1302 Ch 19, Binary I/O CS 1302 Ch 19, Binary I/O Sections Pages Review Questions Programming Exercises 19.1-19.4.1, 19.6-19.6 710-715, 724-729 Liang s Site any Sections 19.1 Introduction 1. An important part of programming is

More information

Input: an array of elements (e.g. integers) Output: an array containing all the elements provided as input in sorted order Steps

Input: an array of elements (e.g. integers) Output: an array containing all the elements provided as input in sorted order Steps Bubble Sort Input: an array of elements (e.g. integers) Output: an array containing all the elements provided as input in sorted order Steps take two adjacent elements at a time and compare them. if input[i]

More information

INPUT AND OUTPUT STREAMS

INPUT AND OUTPUT STREAMS INPUT AND OUTPUT The Java Platform supports different kinds of information sources and information sinks. A program may get data from an information source which may be a file on disk, a network connection,

More information

B.Sc (Honours) - Software Development

B.Sc (Honours) - Software Development Galway-Mayo Institute of Technology B.Sc (Honours) - Software Development E-Commerce Development Technologies II Lab Session Using the Java URLConnection Class The purpose of this lab session is to: (i)

More information

Java I/O. Università di Modena e Reggio Emilia Prof. Nicola Bicocchi

Java I/O. Università di Modena e Reggio Emilia Prof. Nicola Bicocchi Java I/O Università di Modena e Reggio Emilia Prof. Nicola Bicocchi (nicola.bicocchi@unimore.it) Java I/O Stream Buffer File StringTokenizer, StreamTokenizer SerializaAon Stream All I/O operaaons rely

More information

The Java I/O System. Binary I/O streams (ascii, 8 bits) The decorator design pattern Character I/O streams (Unicode, 16 bits)

The Java I/O System. Binary I/O streams (ascii, 8 bits) The decorator design pattern Character I/O streams (Unicode, 16 bits) Binary I/O streams (ascii, 8 bits) InputStream OutputStream The Java I/O System The decorator design pattern Character I/O streams (Unicode, 16 bits) Reader Writer Comparing Binary I/O to Character I/O

More information

CS/CE 2336 Computer Science II

CS/CE 2336 Computer Science II CS/CE 2336 Computer Science II UT D Session 09 Input and Output in Java Adapted from D. Liang s Introduction to Java Programming, 8 th Ed. 2 How is I/O Handled in Java? A Fileobject encapsulates the properties

More information

320341 Programming in Java

320341 Programming in Java 320341 Programming in Java Fall Semester 2014 Lecture 10: The Java I/O System Instructor: Slides: Jürgen Schönwälder Bendick Mahleko Objectives This lecture introduces the following - Java Streams - Object

More information

WRITING DATA TO A BINARY FILE

WRITING DATA TO A BINARY FILE WRITING DATA TO A BINARY FILE TEXT FILES VS. BINARY FILES Up to now, we have looked at how to write and read characters to and from a text file. Text files are files that contain sequences of characters.

More information

AVRO - SERIALIZATION

AVRO - SERIALIZATION http://www.tutorialspoint.com/avro/avro_serialization.htm AVRO - SERIALIZATION Copyright tutorialspoint.com What is Serialization? Serialization is the process of translating data structures or objects

More information

! "# $%&'( ) * ).) "%&' 1* ( %&' ! "%&'2 (! ""$ 1! ""3($

! # $%&'( ) * ).) %&' 1* ( %&' ! %&'2 (! $ 1! 3($ ! "# $%&'( ) * +,'-( ).) /"0'" 1 %&' 1* ( %&' "%&'! "%&'2 (! ""$ 1! ""3($ 2 ', '%&' 2 , 3, 4( 4 %&'( 2(! ""$ -5%&'* -2%&'(* ) * %&' 2! ""$ -*! " 4 , - %&' 3( #5! " 5, '56! "* * 4(%&'(! ""$ 3(#! " 42/7'89.:&!

More information

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring 2014. HDFS Basics

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring 2014. HDFS Basics COSC 6397 Big Data Analytics Distributed File Systems (II) Edgar Gabriel Spring 2014 HDFS Basics An open-source implementation of Google File System Assume that node failure rate is high Assumes a small

More information

Using NetBeans IDE to Build Quick UI s Ray Hylock, GISo Tutorial 3/8/2011

Using NetBeans IDE to Build Quick UI s Ray Hylock, GISo Tutorial 3/8/2011 Using NetBeans IDE to Build Quick UI s Ray Hylock, GISo Tutorial 3/8/2011 We will be building the following application using the NetBeans IDE. It s a simple nucleotide search tool where we have as input

More information

Binary Random-Access I/O in Java TABLE OF CONTENTS

Binary Random-Access I/O in Java TABLE OF CONTENTS Binary Random-Access I/O in Java Revision History: 01/09/24 original by Elliot Wiltshire, TA Cmpt275-d1 (01-3) 01/10/19 Rev. 6 by Russ Tront. Added page numbers (they were in table of contents but not

More information

Chulalongkorn University International School of Engineering Department of Computer Engineering 2140105 Computer Programming Lab.

Chulalongkorn University International School of Engineering Department of Computer Engineering 2140105 Computer Programming Lab. Chulalongkorn University Name International School of Engineering Student ID Department of Computer Engineering Station No. 2140105 Computer Programming Lab. Date Lab 2 Using Java API documents, command

More information

Continuous Integration Part 2

Continuous Integration Part 2 1 Continuous Integration Part 2 This blog post is a follow up to my blog post Continuous Integration (CI), in which I described how to execute test cases in Code Tester (CT) in a CI environment. What I

More information

Communicating with a Barco projector over network. Technical note

Communicating with a Barco projector over network. Technical note Communicating with a Barco projector over network Technical note MED20080612/00 12/06/2008 Barco nv Media & Entertainment Division Noordlaan 5, B-8520 Kuurne Phone: +32 56.36.89.70 Fax: +32 56.36.883.86

More information

Chapter 10. A stream is an object that enables the flow of data between a program and some I/O device or file. File I/O

Chapter 10. A stream is an object that enables the flow of data between a program and some I/O device or file. File I/O Chapter 10 File I/O Streams A stream is an object that enables the flow of data between a program and some I/O device or file If the data flows into a program, then the stream is called an input stream

More information

This class allows the random movement of the file pointers. The file pointer can be moved back and forth.

This class allows the random movement of the file pointers. The file pointer can be moved back and forth. RandomAccessFile This class allows the random movement of the file pointers. The file pointer can be moved back and forth. Constructor: RandomAccessFile(String name, String mode) Creates a random access

More information

Stream I/O and Files 14

Stream I/O and Files 14 Stream I/O and Files 14 Course Map This module discusses the stream I/O mechanism used for files, sockets, and other sources of data. Getting Started The Java Programming Language Basics Identifiers, Keywords,

More information

1.00 Lecture 23. Streams

1.00 Lecture 23. Streams 1.00 Lecture 23 Input/Output Introduction to Streams Exceptions Reading for next time: Big Java 19.3-19.4 Streams Java can communicate with the outside world using streams Picture a pipe feeding data into

More information

Handout 3 cs180 - Programming Fundamentals Spring 15 Page 1 of 6. Handout 3. Strings and String Class. Input/Output with JOptionPane.

Handout 3 cs180 - Programming Fundamentals Spring 15 Page 1 of 6. Handout 3. Strings and String Class. Input/Output with JOptionPane. Handout 3 cs180 - Programming Fundamentals Spring 15 Page 1 of 6 Handout 3 Strings and String Class. Input/Output with JOptionPane. Strings In Java strings are represented with a class type String. Examples:

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Input / Output Framework java.io Framework

Input / Output Framework java.io Framework Date Chapter 11/6/2006 Chapter 10, start Chapter 11 11/13/2006 Chapter 11, start Chapter 12 11/20/2006 Chapter 12 11/27/2006 Chapter 13 12/4/2006 Final Exam 12/11/2006 Project Due Input / Output Framework

More information

Reading a Text File. Reading and Writing Text Files Exceptions. Testing for more input. Example: Count Words

Reading a Text File. Reading and Writing Text Files Exceptions. Testing for more input. Example: Count Words Reading a Text File Reading and Writing Text Files Exceptions 15-121 Fall 2010 Margaret Reid-Miller A Scanner object can be connected to many input sources: keyboard, file, network, string To read a text

More information

What is an I/O Stream?

What is an I/O Stream? Java I/O Stream 1 Topics What is an I/O stream? Types of Streams Stream class hierarchy Control flow of an I/O operation using Streams Byte streams Character streams Buffered streams Standard I/O streams

More information

Apéndice C: Código Fuente del Programa DBConnection.java

Apéndice C: Código Fuente del Programa DBConnection.java Apéndice C: Código Fuente del Programa DBConnection.java import java.sql.*; import java.io.*; import java.*; import java.util.*; import java.net.*; public class DBConnection Connection pgsqlconn = null;

More information

by Deitel & Associates CREARE E SCRIVERE UN FILE SEQUENZIALE

by Deitel & Associates CREARE E SCRIVERE UN FILE SEQUENZIALE CREARE E SCRIVERE UN FILE SEQUENZIALE 1 /* Create a sequential file */ 3 #include 5 int main() 6 { 7 int account; /* account number */ 8 char name[ 30 ]; /* account name */ 9 double balance;

More information

Odoo 8.0. Le nuove API.

Odoo 8.0. Le nuove API. Odoo 8.0 Le nuove API. davide.corio@abstract.it / abstract per pycon6 Nuove API, perchè? più object oriented stile più pythonico hooks risparmio di codice Principali novità uso dei decoratori recordsets

More information

CS1020 Data Structures and Algorithms I Lecture Note #16. File Processing

CS1020 Data Structures and Algorithms I Lecture Note #16. File Processing CS1020 Data Structures and Algorithms I Lecture Note #16 File Processing Objective Input/output on files: reading input from a file and writing data to a file. 2 References Book Chapter 1, Section 1.8,

More information

Nuovi domini di primo livello - Registra nuove estensioni con FabsWeb_HOST

Nuovi domini di primo livello - Registra nuove estensioni con FabsWeb_HOST Oltre 700 nuove estensioni per domini personalizzati Il conto alla rovescia è terminato! Finalmente più di 700 nuove estensioni di dominio gtld stanno per arrivare sul mercato e sono destinate a rivoluzionare

More information

become familiar with the concept of an I/O stream understand the difference between binary files and text files learn how to save data in a file

become familiar with the concept of an I/O stream understand the difference between binary files and text files learn how to save data in a file Chapter 9 become familiar with the concept of an I/O stream understand the difference between binary files and text files learn how to save data in a file learn how to read data from a file Overview of

More information

public static void main(string[] args) { System.out.println("hello, world"); } }

public static void main(string[] args) { System.out.println(hello, world); } } Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static

More information

Organization Requested Amount ( ) Leading Organization Partner 1*

Organization Requested Amount ( ) Leading Organization Partner 1* Integrated research on industrial biotechnologies 2016 Budget 2016 FILL IN THE FORM FOLLOWING THE GUIDELINES AND DO NOT DELATE THEM. PLEASE USE THE FONT TREBUCHET 10PT SINGLE SPACED. PLEASE UPLOAD THE

More information

Versione: 2.1. Interoperabilità del Sistema di Accettazione di SPT

Versione: 2.1. Interoperabilità del Sistema di Accettazione di SPT Versione: 2.1 Interoperabilità del Sistema di Accettazione di SPT INDICE 1 Definizione del tracciato di scambio... 2 1.1.1 XML SCHEMA...... 3 1 Definizione del tracciato di scambio Il documento riporta

More information

D06 PROGRAMMING with JAVA

D06 PROGRAMMING with JAVA Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch15 Exception Handling PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com, for

More information

Introduction to Java. Module 12: Networking (Java Sockets) Prepared by Costantinos Costa for EPL 233. ΕΠΛ233 Αντικειμενοστρεφής Προγραμματισμός 1

Introduction to Java. Module 12: Networking (Java Sockets) Prepared by Costantinos Costa for EPL 233. ΕΠΛ233 Αντικειμενοστρεφής Προγραμματισμός 1 Introduction to Java Module 12: Networking (Java Sockets) Prepared by Costantinos Costa for EPL 233 ΕΠΛ233 Αντικειμενοστρεφής Προγραμματισμός 1 What Is a Socket? A socket is one end-point of a two-way

More information

Anexo XI - Código para Processar PDML e Gerar Script SQL

Anexo XI - Código para Processar PDML e Gerar Script SQL Anexo XI - Código para Processar PDML e Gerar Script SQL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 import java.io.file;

More information

COUNTING LOOPS AND ACCUMULATORS

COUNTING LOOPS AND ACCUMULATORS COUNTING LOOPS AND ACCUMULATORS Two very important looping idioms are counting loops and accumulators. A counting loop uses a variable, called the loop control variable, to keep count of how many cycles

More information

AP Computer Science Static Methods, Strings, User Input

AP Computer Science Static Methods, Strings, User Input AP Computer Science Static Methods, Strings, User Input Static Methods The Math class contains a special type of methods, called static methods. A static method DOES NOT operate on an object. This is because

More information

java.util.scanner Here are some of the many features of Scanner objects. Some Features of java.util.scanner

java.util.scanner Here are some of the many features of Scanner objects. Some Features of java.util.scanner java.util.scanner java.util.scanner is a class in the Java API used to create a Scanner object, an extremely versatile object that you can use to input alphanumeric characters from several input sources

More information

Chapter Four: DFA Applications. Formal Language, chapter 4, slide 1

Chapter Four: DFA Applications. Formal Language, chapter 4, slide 1 Chapter Four: DFA Applications Formal Language, chapter 4, slide 1 1 We have seen how DFAs can be used to define formal languages. In addition to this formal use, DFAs have practical applications. DFAbased

More information

Fondamenti di Java. Introduzione alla costruzione di GUI (graphic user interface)

Fondamenti di Java. Introduzione alla costruzione di GUI (graphic user interface) Fondamenti di Java Introduzione alla costruzione di GUI (graphic user interface) component - container - layout Un Container contiene [0 o +] Components Il Layout specifica come i Components sono disposti

More information

Passare a Sql Server Compact : come leggere dati da Mdb, Xls, Xml, Dbf, Csv, senza utilizzare Microsoft Jet Database Engine 4.0

Passare a Sql Server Compact : come leggere dati da Mdb, Xls, Xml, Dbf, Csv, senza utilizzare Microsoft Jet Database Engine 4.0 Passare a Sql Server Compact : come leggere dati da Mdb, Xls, Xml, Dbf, Csv, senza utilizzare Microsoft Jet Database Engine 4.0 Qualche anno fa ho sviluppato un' applicazione in VB6 per l' ottimizzazione

More information

Internet Technology. 02r. Programming with Sockets Paul Krzyzanowski. Rutgers University. Spring 2013

Internet Technology. 02r. Programming with Sockets Paul Krzyzanowski. Rutgers University. Spring 2013 Internet Technology 02r. Programming with Sockets Paul Krzyzanowski Rutgers University Spring 2013 February 7, 2013 2013 Paul Krzyzanowski 1 Sample Client-Server Program To illustrate programming with

More information

5 HDFS - Hadoop Distributed System

5 HDFS - Hadoop Distributed System 5 HDFS - Hadoop Distributed System 5.1 Definition and Remarks HDFS is a file system designed for storing very large files with streaming data access patterns running on clusters of commoditive hardware.

More information

Application Development with TCP/IP. Brian S. Mitchell Drexel University

Application Development with TCP/IP. Brian S. Mitchell Drexel University Application Development with TCP/IP Brian S. Mitchell Drexel University Agenda TCP/IP Application Development Environment Client/Server Computing with TCP/IP Sockets Port Numbers The TCP/IP Application

More information

Tecnologia e Applicazioni Internet 2008/9

Tecnologia e Applicazioni Internet 2008/9 Tecnologia e Applicazioni Internet 2008/9 Lezione 4 - Rest Matteo Vaccari http://matteo.vaccari.name/ matteo.vaccari@uninsubria.it What is REST? Roy Fielding Representational State Transfer Roy T. Fielding

More information

Applicazioni Web 2014/15

Applicazioni Web 2014/15 Applicazioni Web 2014/15 Lezione 10 - Persistenza Matteo Vaccari http://matteo.vaccari.name/ matteo.vaccari@uninsubria.it Perché usare un DB relazionale? Per l accesso concorrente ai dati (e svincolare

More information

Different types of resources are specified by their scheme, each different pattern is implemented by a specific protocol:

Different types of resources are specified by their scheme, each different pattern is implemented by a specific protocol: Chapter 8 In this chapter we study the features of Java that allows us to work directly at the URL (Universal Resource Locator) and we are particularly interested in HTTP (Hyper Text Transfer Protocol).

More information

Network/Socket Programming in Java. Rajkumar Buyya

Network/Socket Programming in Java. Rajkumar Buyya Network/Socket Programming in Java Rajkumar Buyya Elements of C-S Computing a client, a server, and network Client Request Result Network Server Client machine Server machine java.net Used to manage: URL

More information

Using Files as Input/Output in Java 5.0 Applications

Using Files as Input/Output in Java 5.0 Applications Using Files as Input/Output in Java 5.0 Applications The goal of this module is to present enough information about files to allow you to write applications in Java that fetch their input from a file instead

More information

Zebra and MapReduce. Table of contents. 1 Overview...2 2 Hadoop MapReduce APIs...2 3 Zebra MapReduce APIs...2 4 Zebra MapReduce Examples...

Zebra and MapReduce. Table of contents. 1 Overview...2 2 Hadoop MapReduce APIs...2 3 Zebra MapReduce APIs...2 4 Zebra MapReduce Examples... Table of contents 1 Overview...2 2 Hadoop MapReduce APIs...2 3 Zebra MapReduce APIs...2 4 Zebra MapReduce Examples... 2 1. Overview MapReduce allows you to take full advantage of Zebra's capabilities.

More information

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

More information

Principles, Models, and Applications for Distributed Systems M

Principles, Models, and Applications for Distributed Systems M Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Input-Output, Stream, File Jacopo De Benedetto Stream A stream is a virtually unlimited

More information

How to renew S&S Video Italian version. 2009 IBM Corporation

How to renew S&S Video Italian version. 2009 IBM Corporation How to renew S&S Video Italian version A. Renewal Email Lasciate che vi illustri come rinnovare le vostre licenze software IBM con Passport Advantage Online. (Let me show you how to renew your IBM software

More information

- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire

- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire - Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire il funzionamento della Java Virtual Machine (JVM): -

More information

Chapter 2 Introduction to Java programming

Chapter 2 Introduction to Java programming Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break

More information

MR-(Mapreduce Programming Language)

MR-(Mapreduce Programming Language) MR-(Mapreduce Programming Language) Siyang Dai Zhi Zhang Shuai Yuan Zeyang Yu Jinxiong Tan sd2694 zz2219 sy2420 zy2156 jt2649 Objective of MR MapReduce is a software framework introduced by Google, aiming

More information

Principles of Software Construction: Objects, Design, and Concurrency. Design Case Study: Stream I/O Some answers. Charlie Garrod Jonathan Aldrich

Principles of Software Construction: Objects, Design, and Concurrency. Design Case Study: Stream I/O Some answers. Charlie Garrod Jonathan Aldrich Principles of Software Construction: Objects, Design, and Concurrency Design Case Study: Stream I/O Some answers Fall 2014 Charlie Garrod Jonathan Aldrich School of Computer Science 2012-14 C Kästner,

More information

DTI / Titolo principale della presentazione IPHONE ENCRYPTION. Litiano Piccin. 11 ottobre 2014

DTI / Titolo principale della presentazione IPHONE ENCRYPTION. Litiano Piccin. 11 ottobre 2014 1 IPHONE ENCRYPTION 2 MOBILE FORENSICS Nella Computer Forensics, le evidenze che vengono acquisite sono dispositivi statici di massa; questa significa che possiamo ottenere la stessa immagine (bit stream)

More information

F28DA11 Command Line Java Survival. Phil Trinder and David H. Marwick

F28DA11 Command Line Java Survival. Phil Trinder and David H. Marwick F28DA11 Command Line Java Survival Guide Phil Trinder and David H. Marwick Java with BlueJ BlueJ is a Java development environment explicitly for teaching introductory objectoriented programming Java has

More information

TP N 10 : Gestion des fichiers Langage JAVA

TP N 10 : Gestion des fichiers Langage JAVA TP N 10 : Gestion des fichiers Langage JAVA Rappel : Exemple d utilisation de FileReader/FileWriter import java.io.*; public class Copy public static void main(string[] args) throws IOException File inputfile

More information

Intelligent Motorola Portable Radio Energy System

Intelligent Motorola Portable Radio Energy System IMPRES Smart Energy System Intelligent Motorola Portable Radio Energy System IMPRES Marketing Presentation IMPRES Battery - Intelligent Date produzione batteria Data inizio primo uso IMPRES Numero di carica

More information

Visualize Your Cloud Data Using the Graph Template Language

Visualize Your Cloud Data Using the Graph Template Language ABSTRACT Paper 285-2011 Visualize Your Cloud Data Using the Graph Template Language Krishnan Raghupathi, SAS R&D, Pune, Maharashtra, India As the adoption of cloud computing by enterprise companies picks

More information

Simple Java I/O. Streams

Simple Java I/O. Streams Simple Java I/O Streams All modern I/O is stream-based A stream is a connection to a source of data or to a destination for data (sometimes both) An input stream may be associated with the keyboard An

More information

Source code security testing

Source code security testing Source code security testing Simone Riccetti EMEA PSS Security Services All information represents IBM's current intent, is subject to change or withdrawal without notice, and represents only IBM ISS goals

More information

Phase 1 - Enter Portale dello Studente

Phase 1 - Enter Portale dello Studente Phase 1 - Enter Portale dello Studente Open your browser (Microsoft Internet Explorer or Mozilla Firefox) and type or copy the following URL: http://portalestudente.uniroma3.it/ in the address bar (as

More information

PROJECT: Quiz Game. Java Projects: Quiz Game STEP 1 CREATE A CLASS

PROJECT: Quiz Game. Java Projects: Quiz Game STEP 1 CREATE A CLASS You will need to have covered all of the Java basics tutorials before going any further, please make sure you have completed them all. If you have any questions or get stuck ask a mentor or the person

More information

Distribution: questo livello include le Base Station utilizzate per stabilire la connettività wireless con gli utenti finali.

Distribution: questo livello include le Base Station utilizzate per stabilire la connettività wireless con gli utenti finali. Il presente documento HLD definisce l architettura e le configurazioni necessarie per separare la rete di management dai servizi dati dedicati al traffico cliente, con l obiettivo di poter accedere agli

More information

Licence Informatique Année 2005-2006. Exceptions

Licence Informatique Année 2005-2006. Exceptions Université Paris 7 Java Licence Informatique Année 2005-2006 TD n 8 - Correction Exceptions Exercice 1 La méthode parseint est spécifiée ainsi : public static int parseint(string s) throws NumberFormatException

More information

«Software Open Source come fattore abilitante dei Progetti per le Smart Cities»

«Software Open Source come fattore abilitante dei Progetti per le Smart Cities» «Software Open Source come fattore abilitante dei Progetti per le Smart Cities» Le esperienze nell Electronic Ticketing, nel Wireless Sensor Networks, nei Telematic Services & Location Based Systems Enrico

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. AVRO Tutorial

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. AVRO Tutorial i About the Tutorial Apache Avro is a language-neutral data serialization system, developed by Doug Cutting, the father of Hadoop. This is a brief tutorial that provides an overview of how to set up Avro

More information

Programming Assignment: Development of a Proxy Cache

Programming Assignment: Development of a Proxy Cache Programming Assignment: Development of a Proxy Cache La prova avrà una valutazione da 0 a 3 punti da aggiungere alla media dell esito delle due prove di esonero scritte. La gestione dei thread non è da

More information

1 /*ora sincrinizzata con NTP. Inserendo codice OTP si attiva un servo che ruota di 95 grad. Per chiudere il servo premere 2 "*" mentre per azzerrare

1 /*ora sincrinizzata con NTP. Inserendo codice OTP si attiva un servo che ruota di 95 grad. Per chiudere il servo premere 2 * mentre per azzerrare 1 /*ora sincrinizzata con NTP. Inserendo codice OTP si attiva un servo che ruota di 95 grad. Per chiudere il servo premere 2 "*" mentre per azzerrare il codice premenre "#" 3 */ 4 #include 5 #include

More information

Foglio di Istruzioni Owner s Manual. Autofocus module GR0650. GR0650 Rev. 01 16.03.06

Foglio di Istruzioni Owner s Manual. Autofocus module GR0650. GR0650 Rev. 01 16.03.06 Foglio di Istruzioni Owner s Manual Autofocus module GR0650 GR0650 Rev. 01 16.03.06 INDICE 1.0 CONTENUTO DELL IMBALLAGGIO 3 2.0 SICUREZZA 3 3.0 INSTALLAZIONE 3 3.1 Montaggio sul proiettore 3 4.0 USO DEL

More information

Programmable Graphics Hardware

Programmable Graphics Hardware Programmable Graphics Hardware Alessandro Martinelli alessandro.martinelli@unipv.it 6 November 2011 Rendering Pipeline (6): Programmable Graphics Hardware Rendering Architecture First Rendering Pipeline

More information

Prof. Edwar Saliba Júnior

Prof. Edwar Saliba Júnior package Conexao; 2 3 /** 4 * 5 * @author Cynthia Lopes 6 * @author Edwar Saliba Júnior 7 */ 8 import java.io.filenotfoundexception; 9 import java.io.ioexception; 10 import java.sql.sqlexception; 11 import

More information

www.kdev.it - ProFTPd: http://www.proftpd.org - ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.9.tar.gz

www.kdev.it - ProFTPd: http://www.proftpd.org - ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.9.tar.gz &8730; www.kdev.it ProFTPd Guida per ottenere un server ProFTPd con back-end MySQL. Guida per ottenere un server ProFTPd con back-end MySQL. Condizioni strettamente necessarie: - Mac OS X Developer Tools:

More information

Recitation 8: Static Analysis

Recitation 8: Static Analysis Recitation 8: Static Analysis GOALS This recitation seeks to prepare you for Homework 6. More generally, the goals of this recitation are: Practice creating control flow graphs, Understand data flow analysis,

More information

Creating Custom Web Pages for cagrid Services

Creating Custom Web Pages for cagrid Services Creating Custom Web Pages for cagrid Services Creating Custom Web Pages for cagrid Services Contents Overview Changing the Default Behavior Subclassing the AXIS Servlet Installing and Configuring the Custom

More information

SAFE. DESIGNED in italy CASSEFORTI PER HOTEL HOTEL SAFES

SAFE. DESIGNED in italy CASSEFORTI PER HOTEL HOTEL SAFES SAFE DESIGNED in italy CASSEFORTI PER HOTEL HOTEL SAFES SAFE TOP OPEN SAFE DRAWER Innovativa tastiera touch e display led integrato nella porta New touch keypad and stealthy LED display L apertura dall

More information

СПбНИУ ИТМО Кафедра ВТ. Лабораторная работа 5 по дисциплине «Программирование интернет-приложений» Вариант 2048. Выполнил Широков О.И гр.

СПбНИУ ИТМО Кафедра ВТ. Лабораторная работа 5 по дисциплине «Программирование интернет-приложений» Вариант 2048. Выполнил Широков О.И гр. СПбНИУ ИТМО Кафедра ВТ Лабораторная работа 5 по дисциплине «Программирование интернет-приложений» Вариант 2048 Выполнил Широков О.И гр.2120 Санкт-Петербург г.2013 1. Разделить приложение из лабораторной

More information

Appendix B Task 2: questionnaire and artefacts

Appendix B Task 2: questionnaire and artefacts Appendix B Task 2: questionnaire and artefacts This section shows the questionnaire, the UML class and sequence diagrams, and the source code provided for the task 1 (T2) Buy a Ticket Unsuccessfully. It

More information

ipratico POS Quick Start Guide v. 1.0

ipratico POS Quick Start Guide v. 1.0 ipratico POS Quick Start Guide v. 1.0 Version History Version Pages Comment Date Author 1.0 First Release 5/Marzo/2012 Luigi Riva 2 SUMMARY 1 GETTING STARTED 4 1.1 What do you need? 4 1.2 ipad 5 1.3 Antenna

More information

HDFS - Java API. 2012 coreservlets.com and Dima May. 2012 coreservlets.com and Dima May

HDFS - Java API. 2012 coreservlets.com and Dima May. 2012 coreservlets.com and Dima May 2012 coreservlets.com and Dima May HDFS - Java API Originals of slides and source code for examples: http://www.coreservlets.com/hadoop-tutorial/ Also see the customized Hadoop training courses (onsite

More information

AWS Encryption SDK. Developer Guide

AWS Encryption SDK. Developer Guide AWS Encryption SDK Developer Guide AWS Encryption SDK: Developer Guide Copyright 2016 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be

More information

SAFE TOP OPEN. Sistema di chiusura Locking system

SAFE TOP OPEN. Sistema di chiusura Locking system SAFE: I MODELLI SAFE: MODELS SAFE TOP OPEN Innovativa tastiera touch e display led integrato nella porta New touch keypad and stealthy LED display L apertura dall alto permette un ergonomico accesso al

More information

Organization Requested Amount ( ) Leading Organization Partner 1*

Organization Requested Amount ( ) Leading Organization Partner 1* Budget form 2016 FILL IN THE FORM FOLLOWING THE GUIDELINES AND DO NOT DELETE THEM. PLEASE USE THE FONT TREBUCHET 10PT, SINGLE-SPACED. PLEASE UPLOAD AS A PDF FILE. Si precisa che, per facilitare l inserimento

More information

DIRECTORS AND OFFICERS PROPOSTA DI POLIZZA

DIRECTORS AND OFFICERS PROPOSTA DI POLIZZA DIRECTORS AND OFFICERS PROPOSTA DI POLIZZA La presente proposta deve essere compilata dall`amministratore o dal Sindaco della Societa` proponente dotato di opportuni poteri. La firma della presente proposta

More information