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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Jussi Pohjolainen
April 26, 2020
Technology
1
220
Process API
Simple examples how to execute shell commands using Java
Jussi Pohjolainen
April 26, 2020
Tweet
Share
More Decks by Jussi Pohjolainen
See All by Jussi Pohjolainen
Introduction to Python (under construction)
pohjus
0
1.8k
Sustainability in Web Development - How to Optimize React Apps?
pohjus
0
150
Modern software development and fundamentals of AI
pohjus
0
140
C / C++ - language
pohjus
1
490
TypeScript for JS Developers
pohjus
0
410
Introduction to SwiftUI (2025-04-22)
pohjus
0
240
Kotlin Coroutines
pohjus
0
540
Android HTTP Clients
pohjus
0
530
Introduction to Jetpack Compose
pohjus
2
900
Other Decks in Technology
See All in Technology
プロダクト開発の品質を守るAIコードレビュー:事例に見る導入ポイント
moongift
PRO
1
540
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
【PyCon mini Shizuoka 2026】生成AI時代に画像処理やオーディオ処理のノードエディターを作る理由
kazuhitotakahashi
0
180
Digitization部 紹介資料
sansan33
PRO
1
6.9k
社内ワークショップで終わらせない 業務改善AIエージェント開発
lycorptech_jp
PRO
1
390
AWS CDK の目玉新機能「Mixins」とは / cdk-mixins
gotok365
2
290
「データとの対話」の現在地と未来
kobakou
0
850
生成AI活用によるPRレビュー改善の歩み
lycorptech_jp
PRO
4
1.6k
LY Tableauでの Tableau x AIの実践 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
840
Microsoft Fabric のワークスペースと容量の設計原則
ryomaru0825
2
200
論文検索を日本語でできるアプリを作ってみた
sailen2
0
130
primeNumber DATA MANAGEMENT CAMP #2:
masatoshi0205
1
610
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
79
Code Reviewing Like a Champion
maltzj
527
40k
New Earth Scene 8
popppiees
1
1.6k
Unsuck your backbone
ammeep
671
58k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
240
Context Engineering - Making Every Token Count
addyosmani
9
720
Producing Creativity
orderedlist
PRO
348
40k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
260
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
130
Balancing Empowerment & Direction
lara
5
920
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()); } }