Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Process API
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Jussi Pohjolainen
April 26, 2020
Technology
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Process API
Simple examples how to execute shell commands using Java
Jussi Pohjolainen
April 26, 2020
More Decks by Jussi Pohjolainen
See All by Jussi Pohjolainen
Introduction to Python (under construction)
pohjus
0
1.9k
Sustainability in Web Development - How to Optimize React Apps?
pohjus
0
180
Modern software development and fundamentals of AI
pohjus
0
160
C / C++ - language
pohjus
1
530
TypeScript for JS Developers
pohjus
0
430
Introduction to SwiftUI (2025-04-22)
pohjus
0
270
Kotlin Coroutines
pohjus
0
560
Android HTTP Clients
pohjus
0
540
Introduction to Jetpack Compose
pohjus
2
950
Other Decks in Technology
See All in Technology
【FinOps】データドリブンな意思決定を目指して
z63d
3
600
Claude Code 珍プレー好プレー
shinyasaita
0
120
事業価値を⽣み出すSREへ SREが担うべき意思決定の5層
kenta_hi
0
140
ご挨拶「10周年を迎える共創ラボのこれまでとこれから」
iotcomjpadmin
0
180
プロンプト_きのこカンファレンス2026_LT
yurufuwahealer
0
130
LiDAR SLAMの実装とセンサ融合 ~Lie群からContinuous-Time LIOまで~
naokiakai
1
930
きのこカンファレンス2026_肩書きを外したとき私は誰か
yamasatimi
1
130
アラート調査向けAIエージェントの本番導入とその後/AI Agents for Alert Investigation: Production Deployment and After
taddy_919
1
330
AIエージェントとPhysical AIが拓く製造業の変革(ハノーバーメッセリキャップ)
iotcomjpadmin
0
210
初めてのDatabricks勉強会
taka_aki
2
230
MySQL & MySQL HeatWave Report - June 2026
freshdaz
0
300
ゼロをイチにする仕事が終わったあと
smasato
0
270
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.7k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Docker and Python
trallard
47
3.9k
Design in an AI World
tapps
1
260
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
Raft: Consensus for Rubyists
vanstee
141
7.6k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
220
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
180
How to Talk to Developers About Accessibility
jct
2
280
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
630
Transcript
Properties API Jussi Pohjolainen
To store preferences • Simple API to • fetch •
store • key value pairs
import java.io.*; import java.util.*; class Main { public static void
main(String [] args) throws Exception { Properties prop = new Properties(); // set key and value prop.setProperty("fontSize", "24"); prop.setProperty("fontColor", "RGB(255,255,255)"); String optionalComments = "My preferences file"; prop.store(new FileWriter("./myfile.prop"), optionalComments); } }
myfile.prop #My preferences file #Sun Apr 26 10:56:55 EEST 2020
fontSize=24 fontColor=RGB(255,255,255)
Reading import java.io.*; import java.util.*; class Main { public static
void main(String [] args) throws Exception { Properties prop = new Properties(); prop.load(new FileReader("./myfile.prop")); System.out.println(prop.get("fontSize")); System.out.println(prop.get("fontColor")); } }
Storing XML import java.io.*; import java.util.*; class Main { public
static void main(String [] args) throws Exception { Properties prop = new Properties(); // set key and value prop.setProperty("fontSize", "24"); prop.setProperty("fontColor", "RGB(255,255,255)"); String optionalComments = "My preferences file"; prop.storeToXML(new FileOutputStream("./myfile.xml"), optionalComments); } }
myfile.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>My
preferences file</comment> <entry key="fontSize">24</entry> <entry key="fontColor">RGB(255,255,255)</entry> </properties>
Reading import java.io.*; import java.util.*; class Main { public static
void main(String [] args) throws Exception { Properties prop = new Properties(); prop.loadFromXML(new FileInputStream("./myfile.xml")); System.out.println(prop.getProperty("fontSize")); System.out.println(prop.getProperty("fontColor")); } }
Jackson
Jackson • Java classes to json mapping • External class
library, add dependency • You can use Jackson to save for example preferences file
Dependency <dependencies> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.10.3</version> </dependency> </dependencies>
Pojo public class Dog { private String name; public void
setName(String name) { this.name = name; } public String getName() { return this.name; } }
Main import com.fasterxml.jackson.databind.ObjectMapper; import java.io.*; class Main { public static
void main(String [] args) throws Exception { Dog spot = new Dog(); spot.setName("Spot"); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.writeValue(new File("./file.json"), spot); Dog temp = objectMapper.readValue(new File("./file.json"), Dog.class); System.out.println(temp.getName()); } }