mirror of
https://github.com/Steffo99/unimore-oop-2020-cleaver.git
synced 2024-11-23 08:34:19 +00:00
More progress
This commit is contained in:
parent
d9e1e6a935
commit
44cd6b5134
31 changed files with 336 additions and 31 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -115,5 +115,3 @@ fabric.properties
|
||||||
.idea/**/markdown-navigator/
|
.idea/**/markdown-navigator/
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/java,jetbrains
|
# End of https://www.gitignore.io/api/java,jetbrains
|
||||||
|
|
||||||
sample/
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/docs" />
|
<excludeFolder url="file://$MODULE_DIR$/docs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/sample" />
|
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|
3
examples/README.md
Normal file
3
examples/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Cleaver examples
|
||||||
|
|
||||||
|
- `loremipsum.txt`: 50 paragraphs of Lorem Ipsum generated from [lipsum.com](https://lipsum.com).
|
101
examples/loremipsum.txt
Normal file
101
examples/loremipsum.txt
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
# From https://lipsum.com/
|
||||||
|
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi hendrerit vitae quam vel placerat. Donec aliquet sed dolor in imperdiet. Pellentesque lacinia dictum risus semper tincidunt. Donec non metus vitae augue dignissim venenatis vitae in erat. Pellentesque elementum interdum tellus eu finibus. Vivamus et justo in nisl cursus feugiat. Phasellus finibus fringilla tortor, et posuere nisi maximus id. Pellentesque a egestas magna, sit amet ullamcorper orci.
|
||||||
|
|
||||||
|
In a sagittis tortor, eu maximus felis. Duis pharetra orci ut pretium tempus. Maecenas sed pretium ante. Cras a dictum lectus. Praesent non leo dui. Suspendisse volutpat faucibus mi, quis congue lectus dapibus at. Nullam ipsum ligula, tempor sed nisl a, molestie vestibulum nunc. Donec pellentesque enim eget lorem lobortis feugiat. Etiam facilisis ante sit amet nunc euismod, eu tristique odio interdum. Quisque sodales semper dolor at pretium. Etiam at sapien tellus. Suspendisse potenti.
|
||||||
|
|
||||||
|
Praesent ultricies nunc blandit felis eleifend, non elementum mi luctus. Phasellus bibendum mauris vitae dapibus interdum. Phasellus dictum risus et efficitur cursus. Nullam sed finibus justo. Donec nec sapien pretium, laoreet diam a, convallis nunc. Aliquam non ante tortor. Maecenas viverra ligula tempor maximus lobortis.
|
||||||
|
|
||||||
|
Quisque sodales congue finibus. Ut augue dolor, molestie sodales quam at, placerat varius neque. Mauris et tincidunt magna, eget posuere justo. Aenean euismod arcu in quam imperdiet mattis. Pellentesque pharetra erat vitae est accumsan, ac placerat ligula lacinia. Maecenas diam nisl, dictum eget sollicitudin at, consectetur vitae nisi. Pellentesque sollicitudin, urna ac hendrerit pellentesque, nibh ipsum tristique risus, ut venenatis enim dui a ex. Etiam bibendum mollis tellus vitae venenatis. Nunc scelerisque eros sed dolor tempus mattis.
|
||||||
|
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque id risus quis est sollicitudin aliquam at non diam. Aenean viverra vel odio ac blandit. Cras leo enim, iaculis in faucibus eget, dictum vel dolor. Fusce vel nisl laoreet sapien tempor pellentesque. Fusce a lorem ut ante finibus feugiat. Mauris vehicula, nulla vitae posuere venenatis, erat lectus tempor odio, in dignissim dolor nisl ut nunc. Vivamus tristique dignissim neque. Nulla fringilla sed lectus vitae placerat. Donec vitae nulla imperdiet, venenatis purus vel, elementum odio.
|
||||||
|
|
||||||
|
Fusce et imperdiet nisi. Praesent molestie enim orci, ut feugiat tellus facilisis a. Donec vitae turpis ultricies, vestibulum ipsum non, tempus massa. Nam accumsan lobortis ante, vitae porttitor turpis cursus eu. Suspendisse potenti. Mauris rutrum auctor augue, nec faucibus ipsum vestibulum id. Proin vehicula condimentum sem. Donec at ultrices orci. Sed bibendum nibh vel mi euismod, ut sodales ex pretium. Nunc sit amet semper orci, id blandit ligula. Aenean interdum, mi eget tincidunt imperdiet, mauris est euismod elit, sollicitudin sodales nisi nulla sed ante.
|
||||||
|
|
||||||
|
Phasellus at iaculis lorem. Vivamus eget bibendum diam. Sed eget leo vel orci ornare pharetra quis in odio. Mauris nulla elit, posuere vitae dolor sit amet, laoreet pulvinar metus. Integer magna lacus, ornare finibus pharetra ut, tempor non neque. Cras molestie tempor enim et auctor. Pellentesque eget vestibulum urna, ut porttitor sem. Etiam gravida nisl lectus. Suspendisse potenti. Ut maximus ullamcorper mi, et eleifend ante tempus et. Nunc leo sem, malesuada vel sapien sed, ornare ornare metus. Nulla vitae ante eget velit venenatis sodales a dapibus ipsum. Phasellus justo lectus, maximus sit amet tempus eget, tempus ac velit. Phasellus nec pellentesque massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In hac habitasse platea dictumst.
|
||||||
|
|
||||||
|
Proin ultricies, ante eu finibus consectetur, eros urna aliquam libero, nec placerat purus mi et dolor. Cras laoreet id tortor sit amet tincidunt. Proin varius viverra ultrices. Aenean vitae turpis vitae erat porttitor pellentesque. Proin in ante non velit mollis iaculis. Phasellus dignissim vel metus finibus vulputate. Curabitur varius est eget nisi ultricies, vitae suscipit lectus venenatis. Vestibulum feugiat libero ac urna feugiat rhoncus. Morbi tempus tincidunt tempor. Suspendisse lobortis metus eget scelerisque commodo. Integer velit orci, tristique id arcu sed, scelerisque imperdiet purus. Duis rhoncus augue id sapien rutrum sollicitudin. Mauris scelerisque nibh a enim vestibulum, id fringilla nulla pellentesque. Phasellus euismod sapien vulputate nisl aliquet, sodales feugiat lectus efficitur. Mauris egestas cursus odio sit amet tincidunt.
|
||||||
|
|
||||||
|
Maecenas lacinia orci mauris, sed pretium ante eleifend dignissim. Suspendisse feugiat vel enim eget tincidunt. Sed consectetur, orci eu condimentum ornare, leo lacus convallis nisl, semper volutpat eros orci non enim. Curabitur a dapibus lorem. In et bibendum neque. Mauris eget vestibulum diam. Suspendisse lacinia nulla vel efficitur faucibus. Quisque id tristique lectus, tincidunt egestas ex. Nullam feugiat, lorem a sollicitudin varius, eros quam dignissim nulla, in sodales nisl dolor non erat. Nullam interdum ultricies mi, quis dapibus orci scelerisque id.
|
||||||
|
|
||||||
|
Quisque vestibulum ipsum sed purus maximus volutpat. In id hendrerit ex. Praesent vestibulum nibh augue, dignissim egestas nisl placerat vehicula. Etiam eu sollicitudin eros, a condimentum mauris. Ut fringilla sapien ac suscipit rhoncus. Fusce ex ligula, convallis a pulvinar vel, varius ut lectus. Nam vehicula in quam eu ornare. Integer eget nulla turpis. In consequat fringilla magna eu tempus. Nam ut urna nisl.
|
||||||
|
|
||||||
|
Quisque consequat nisl sit amet velit pharetra, at bibendum ipsum dapibus. Vivamus euismod nisl dolor, quis ultricies orci elementum ac. Vestibulum interdum porta turpis, sed pulvinar arcu dapibus a. Sed cursus ultrices aliquam. Mauris venenatis dolor id urna egestas, id faucibus justo scelerisque. Donec lobortis sollicitudin tellus. Mauris quis dolor hendrerit, interdum tellus quis, mattis diam. Vivamus molestie ligula a fermentum consectetur. Donec ut euismod eros, ut efficitur diam. Morbi tortor metus, accumsan non gravida vel, consectetur vel velit. Suspendisse in quam congue, commodo est vitae, elementum turpis. Vestibulum nunc tellus, faucibus ac scelerisque at, maximus eu quam. Vivamus tincidunt non erat tempus laoreet.
|
||||||
|
|
||||||
|
Pellentesque sit amet nibh mauris. Nulla venenatis massa at vestibulum auctor. Nulla quis lectus quis nunc aliquam rhoncus vel a nulla. Aenean sagittis placerat imperdiet. Phasellus arcu mi, vehicula eu dui ac, volutpat mattis ipsum. In eu eros a dui tristique posuere. Ut non eros egestas, facilisis felis sagittis, semper erat. Proin ut commodo nibh. Etiam quis scelerisque felis. Suspendisse viverra imperdiet augue ac auctor. Aenean ultrices lorem eu diam tincidunt, eget egestas metus auctor. Proin a nisi cursus, iaculis dolor quis, aliquet magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent lacinia eros id ex pulvinar, at ultrices diam rutrum. In facilisis sodales massa vitae sodales.
|
||||||
|
|
||||||
|
Suspendisse consequat libero purus, ac tincidunt lectus porta non. Proin mattis diam ac pulvinar aliquet. Nunc finibus elit in sem porttitor, ac sodales turpis sodales. Morbi et rhoncus erat. Etiam vestibulum consequat velit, quis hendrerit mauris tincidunt sit amet. Sed cursus nisi non porta malesuada. Proin a feugiat massa. Integer rutrum consectetur congue. Fusce ut auctor mauris. Mauris et tortor fermentum, maximus nunc vel, suscipit risus. Vivamus pharetra ligula at odio tempor tincidunt. Sed elementum justo arcu, et tempor risus tincidunt nec. Cras ac blandit massa, sit amet auctor tortor. Sed accumsan nibh urna, vel pretium justo congue ac. Nulla id augue velit.
|
||||||
|
|
||||||
|
Donec rhoncus interdum tortor id scelerisque. Aenean gravida odio at sem placerat, eu placerat risus sollicitudin. Integer iaculis, diam quis lacinia maximus, libero arcu commodo turpis, at porta elit sapien non erat. Duis at pharetra sapien, eu tincidunt nibh. In hac habitasse platea dictumst. Quisque lacinia risus et sem mollis, vitae imperdiet orci tincidunt. Aenean tempus felis lectus, eget malesuada purus bibendum ac. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
|
||||||
|
|
||||||
|
Nunc sit amet tellus ornare, cursus odio id, suscipit dui. Proin condimentum sem erat, in sodales sem cursus hendrerit. Nullam eu venenatis justo, vel rhoncus felis. Quisque in porttitor libero, quis viverra nunc. Cras tempus felis sem, vel pulvinar velit gravida sed. Integer consectetur mi quis arcu tempus mattis. Nunc metus quam, rutrum at porta vitae, sollicitudin vitae leo. Sed et aliquet sem. In luctus, lacus eget euismod viverra, sapien libero accumsan turpis, in porttitor purus sapien non ex. Aliquam eget neque ligula. Duis porttitor ipsum vel magna vestibulum, ut sollicitudin ex semper. Nullam iaculis scelerisque massa, at malesuada enim fermentum quis.
|
||||||
|
|
||||||
|
Morbi fermentum faucibus mi et cursus. In feugiat elementum rhoncus. In ut gravida dui, eu pulvinar est. Suspendisse sed euismod tortor, in tempus sem. Donec luctus quam mattis mi consectetur congue. Aenean tellus nisi, gravida sed augue ac, vestibulum venenatis mauris. Etiam venenatis sollicitudin enim eget consectetur. Sed a porttitor libero. Duis quis nulla a magna eleifend egestas. Nunc faucibus ligula ut egestas venenatis. Vivamus gravida sem diam, et ultricies quam suscipit semper. Quisque risus urna, fringilla at mauris nec, ullamcorper interdum arcu. Pellentesque id dolor sed massa fermentum laoreet. Pellentesque posuere enim sit amet nulla pretium dignissim vel ac purus. Cras accumsan eleifend nisl, eu dignissim purus ultricies sit amet.
|
||||||
|
|
||||||
|
Ut laoreet augue porta vulputate sollicitudin. Vestibulum sagittis, erat vel dignissim interdum, diam ante varius erat, sed ultricies orci ligula sed felis. Nullam congue lacus dui, cursus maximus arcu fringilla in. Vivamus pellentesque diam sed libero consequat, non viverra lorem fermentum. Nam ac libero eros. Aliquam sodales ligula libero, ac sodales sem aliquam vitae. Donec non auctor est. Suspendisse rhoncus nisi in aliquet sollicitudin. Donec consectetur viverra lacus, nec vehicula odio pulvinar sed.
|
||||||
|
|
||||||
|
Donec eu ultricies arcu. Sed quis justo nulla. Donec luctus tellus in dolor pellentesque accumsan. Duis eget dui nec nisl aliquam ullamcorper non eget ipsum. Phasellus nec vehicula ex. Sed metus orci, fermentum vel enim et, rhoncus fermentum diam. Integer sollicitudin tincidunt neque, in viverra enim posuere vel. Sed in quam nec mi tristique tincidunt. Cras volutpat sem blandit erat interdum, vitae dapibus velit semper. Phasellus vulputate massa ipsum, vel vulputate nibh facilisis ut. Nulla facilisi.
|
||||||
|
|
||||||
|
Curabitur a erat et lorem ultricies lacinia at sed leo. Pellentesque non consectetur augue. Nulla sem risus, laoreet sed purus sed, sodales rutrum magna. Curabitur orci orci, tincidunt vel magna tristique, aliquet commodo libero. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut nisl velit, pharetra non est molestie, facilisis mollis mi. Nunc vel tellus ac est vulputate interdum. Quisque molestie enim ac massa tincidunt, et commodo lacus venenatis. Curabitur interdum est neque, non porta orci scelerisque sit amet. Vestibulum consequat risus vitae commodo dignissim. Aenean sed purus pellentesque, pretium ex vel, pulvinar purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sed congue libero, vitae mollis est. Nullam ultricies lobortis urna ut malesuada.
|
||||||
|
|
||||||
|
Pellentesque euismod dignissim mauris ut hendrerit. Cras gravida mi id nulla dictum, sit amet eleifend nisi commodo. Duis aliquam diam felis. Nam facilisis, diam sed vestibulum ornare, lorem nisi dictum ex, at finibus dui tellus ac est. Ut mattis consectetur sodales. Integer ultrices pellentesque turpis ac iaculis. Sed mattis tellus ut suscipit iaculis. Nunc semper mattis interdum. Curabitur ultrices mollis lacus, tempor imperdiet velit dictum vitae. Nam scelerisque dui eu felis pellentesque consectetur. Nullam molestie vestibulum erat elementum placerat. Quisque neque mi, vehicula in fermentum sit amet, malesuada vel diam.
|
||||||
|
|
||||||
|
Aenean eget faucibus erat. Proin cursus libero ut dictum tempus. Nunc ullamcorper hendrerit ligula in hendrerit. Morbi dapibus lacus et rhoncus congue. Sed at iaculis eros. Aliquam posuere eleifend accumsan. Aenean varius aliquam nulla nec sodales. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla porta ligula ac nunc finibus efficitur. Sed leo mauris, pellentesque nec justo nec, mattis interdum velit. Nulla at velit dolor. Mauris nec dictum eros, sed tincidunt massa. Praesent varius nibh vel nunc ullamcorper, sed facilisis nisl consectetur. Nullam orci magna, iaculis in tincidunt at, congue non leo. Vivamus bibendum non neque a lobortis. Donec molestie nisl nunc, sit amet tristique elit accumsan quis.
|
||||||
|
|
||||||
|
Praesent scelerisque commodo turpis, vitae ultricies odio. Curabitur ut accumsan nisi. Nullam odio mauris, pharetra sed est nec, vestibulum volutpat felis. Quisque non nibh libero. Curabitur quis tellus sit amet elit gravida blandit quis sed ex. Etiam tempor dictum lorem quis finibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam placerat tortor quam, id consequat enim semper vitae. Praesent in elit quis mauris bibendum euismod a a risus. Integer in risus vitae nibh commodo convallis. Integer feugiat orci ipsum, sit amet dictum enim finibus eu. Donec malesuada sapien a feugiat vehicula. Proin imperdiet augue a mi malesuada mattis. Quisque nec nunc sit amet risus hendrerit convallis.
|
||||||
|
|
||||||
|
Proin tincidunt dui vitae mi dictum scelerisque. Donec sollicitudin neque ligula, venenatis hendrerit risus volutpat porta. Nulla venenatis nulla tortor, ac ultricies risus venenatis sit amet. Fusce a ultricies dui. Morbi fermentum sem orci, a pharetra nibh fringilla ornare. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nam arcu augue, scelerisque nec ipsum a, malesuada efficitur nulla. Mauris a nisi et dolor faucibus tristique id sit amet enim. Aliquam vitae ultricies velit. Sed venenatis tristique magna ac commodo. Donec eu maximus urna, at pellentesque risus. Nullam commodo velit id posuere condimentum. Aliquam vitae molestie metus, nec commodo tellus.
|
||||||
|
|
||||||
|
Donec sit amet dolor malesuada, molestie mauris vitae, hendrerit mauris. Suspendisse potenti. Maecenas ullamcorper congue quam ac gravida. Integer auctor euismod auctor. Donec blandit turpis sit amet finibus suscipit. Vivamus consequat a eros in pulvinar. Proin risus lacus, rhoncus eu ligula at, elementum hendrerit neque. Quisque sagittis hendrerit condimentum. Etiam maximus libero auctor, vehicula tellus vel, auctor urna. Praesent eu diam tempus, porttitor magna ac, elementum neque.
|
||||||
|
|
||||||
|
Maecenas blandit molestie nulla, eget finibus risus lobortis at. Ut orci ligula, porta mollis quam a, tincidunt accumsan massa. Quisque gravida leo vitae tortor accumsan, non tempor sem dictum. Donec aliquet nec lorem sed dapibus. Vestibulum tincidunt luctus ante, eget aliquam velit viverra vel. Pellentesque a ornare massa. Quisque condimentum risus quis odio pharetra, in malesuada metus pulvinar. Pellentesque eros sapien, pellentesque vel eleifend non, dictum a enim. Pellentesque vitae pretium augue. Nulla id ultricies neque. Sed sed luctus neque. Curabitur ut justo nec leo varius consequat.
|
||||||
|
|
||||||
|
Quisque blandit, sem sit amet vehicula dignissim, quam tellus sollicitudin tortor, a sagittis augue elit at sapien. Ut convallis aliquet egestas. Nam iaculis massa nec nisl varius, ac lobortis purus elementum. Cras finibus dictum dolor eu eleifend. Integer mattis, urna at congue interdum, tortor purus cursus tortor, sed placerat turpis turpis eu sapien. Mauris at felis interdum, euismod lorem porttitor, malesuada urna. Duis accumsan eleifend semper. Ut eros ante, iaculis vel ante maximus, ullamcorper sagittis urna. Nunc ut orci nec ante cursus mattis. Morbi nec rhoncus ligula. In ac libero pellentesque, porttitor odio sed, tempus enim. Sed quis nunc nec dui bibendum cursus vel et justo. In ultrices augue ut odio luctus, nec commodo tortor posuere.
|
||||||
|
|
||||||
|
Vestibulum ac pellentesque enim, at pharetra magna. Cras facilisis nunc vitae magna auctor tempor. Vivamus fringilla sodales lobortis. Donec consequat, lacus sed laoreet iaculis, justo mauris tincidunt dolor, quis mollis nisl velit mattis mauris. Maecenas bibendum vehicula volutpat. Proin a arcu pulvinar, venenatis massa vitae, porta ante. Nunc consectetur ornare semper. Fusce egestas diam laoreet nunc mollis gravida. Mauris fermentum ipsum et diam aliquam, sagittis suscipit ante iaculis.
|
||||||
|
|
||||||
|
Nullam non ullamcorper elit. Sed fringilla nisi in nunc lobortis, ac laoreet turpis tempor. Curabitur sit amet consectetur lectus. Donec cursus quis libero nec pulvinar. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris tincidunt eleifend eros, eget cursus nisi finibus eget. Sed ut fermentum orci, fermentum rhoncus dui. Sed tempus neque et laoreet vulputate. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus quis condimentum lacus, ac tempor lorem. Suspendisse viverra justo eget justo aliquam tristique. Cras laoreet urna sem, nec tempus sem rhoncus eu. Sed sit amet feugiat nunc.
|
||||||
|
|
||||||
|
Nullam sem felis, ornare sagittis sapien vel, sagittis auctor est. Curabitur eu rutrum ante, eget tincidunt elit. Morbi mauris sem, auctor quis blandit vel, lobortis ut leo. Ut ac nulla ut nisi gravida tempor ac ut velit. Phasellus ultrices ex ac erat pellentesque, ut aliquam risus sollicitudin. Donec accumsan metus at pulvinar suscipit. Duis sollicitudin ac lorem et efficitur. Curabitur rhoncus id est sit amet hendrerit. Nam arcu diam, vestibulum a sem tempus, euismod condimentum lacus. Proin fringilla lacus ac ipsum egestas ultrices. Duis vestibulum porta semper. Curabitur dapibus metus vitae enim vulputate, eget facilisis tellus varius. Maecenas quis blandit enim, et tempor nunc. Praesent tincidunt mi ac nunc hendrerit commodo. Integer eget molestie nunc.
|
||||||
|
|
||||||
|
Morbi massa nibh, pulvinar et ullamcorper iaculis, volutpat ut tortor. Nunc iaculis laoreet lectus eget bibendum. Integer sed felis sagittis, porta velit in, dignissim eros. Aliquam erat volutpat. In hac habitasse platea dictumst. Etiam id iaculis felis. Praesent lacinia in eros in feugiat. Aliquam pharetra convallis nibh vitae accumsan. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus a nunc sit amet nisi gravida fringilla in porta dui. Curabitur a arcu nec quam vulputate vehicula vel sit amet diam. Proin vestibulum, velit sed tempus sollicitudin, velit libero lobortis est, nec suscipit sapien purus ac nulla. Vivamus in vestibulum felis. Nam ultrices semper nisi, a posuere nibh auctor a. Curabitur posuere odio vel pellentesque posuere.
|
||||||
|
|
||||||
|
Proin finibus erat ac blandit pharetra. Nam venenatis arcu nec elit pretium, sit amet luctus quam eleifend. Vestibulum varius a massa in malesuada. Morbi pharetra egestas felis, et vehicula nisl elementum ut. Etiam sit amet magna sit amet nisl pretium pretium in elementum ex. Nam tincidunt risus commodo, sagittis leo a, tristique ex. Aenean vitae tempor turpis. Suspendisse suscipit porttitor facilisis. Aliquam elementum elit ac magna tempus, a luctus magna condimentum. In nibh quam, molestie et nibh a, hendrerit maximus elit. Sed molestie eget magna vitae pellentesque.
|
||||||
|
|
||||||
|
Duis quis aliquet lacus. Nunc iaculis justo ac fermentum luctus. Sed volutpat pellentesque tristique. In porttitor, eros posuere condimentum maximus, arcu augue vestibulum lorem, at tristique mi libero mollis leo. Nunc ut tempus lectus. Maecenas faucibus lorem quis urna auctor tincidunt. Nulla in placerat eros. Vivamus auctor fringilla odio. Maecenas suscipit, ante eu pulvinar ornare, nulla neque suscipit sapien, nec venenatis metus est sit amet sem. Pellentesque feugiat malesuada diam quis malesuada.
|
||||||
|
|
||||||
|
Fusce vel libero vel est ornare sagittis ut ac erat. Vestibulum euismod odio ipsum, eget vestibulum est euismod quis. Cras id neque elementum, dictum odio eget, laoreet metus. Fusce in leo ut sem porta dictum vel eu sem. Pellentesque eget lacus sed neque tincidunt auctor. Fusce libero neque, placerat nec eleifend eu, sagittis vel diam. Quisque et ultrices nisi, id rutrum mi. Aenean consectetur arcu eu lacus molestie finibus.
|
||||||
|
|
||||||
|
Nullam feugiat libero dolor, nec tincidunt lectus eleifend et. Nullam fermentum mauris et odio molestie, vitae suscipit orci pulvinar. Integer egestas orci nibh, rhoncus tristique metus commodo ac. In hac habitasse platea dictumst. Integer at nibh diam. Nam aliquam pulvinar tincidunt. In hac habitasse platea dictumst. Vestibulum fringilla metus ipsum, et vestibulum elit faucibus quis. Vestibulum non purus pellentesque, varius tortor dictum, vehicula nulla. Donec egestas ornare nunc sit amet aliquam. Nunc turpis urna, molestie vestibulum eros eget, elementum ultrices leo. Donec vehicula interdum neque. Morbi imperdiet pharetra urna vel egestas. Morbi nec venenatis dolor. Vivamus elementum accumsan neque lobortis gravida.
|
||||||
|
|
||||||
|
Nunc sapien magna, mattis id convallis ac, luctus vitae diam. Proin viverra mattis mauris vel interdum. Fusce tincidunt condimentum placerat. Nullam feugiat lectus posuere pretium faucibus. Quisque nulla massa, vestibulum at est aliquet, convallis sollicitudin massa. Donec sollicitudin tortor in libero interdum, a aliquam augue interdum. Fusce nunc lorem, gravida sed ex non, tempor porttitor ligula. In scelerisque aliquam ornare.
|
||||||
|
|
||||||
|
Quisque quam elit, laoreet quis placerat id, aliquam vitae risus. Vestibulum vel lorem velit. Integer imperdiet tempor dignissim. Morbi rhoncus odio quis efficitur venenatis. Fusce tristique consequat nulla vitae dapibus. Suspendisse rhoncus nunc non magna ornare lacinia. In lacinia sagittis urna, vitae malesuada lorem tincidunt blandit. Vestibulum a purus tempus orci tristique aliquam in vel nibh. In hac habitasse platea dictumst. Fusce nec diam vitae risus feugiat dignissim.
|
||||||
|
|
||||||
|
Suspendisse quis risus metus. Nam convallis a enim dapibus elementum. Donec at tellus eu sapien laoreet accumsan. Donec ultrices sodales est quis posuere. Mauris posuere turpis non commodo efficitur. Morbi nibh metus, tempor in velit nec, dignissim gravida mi. Suspendisse cursus tempus leo sed aliquam. Morbi nulla ex, facilisis non ante ac, efficitur ullamcorper felis. Phasellus tristique, urna vel finibus iaculis, libero urna viverra erat, sed iaculis lacus felis eget ipsum.
|
||||||
|
|
||||||
|
Donec maximus facilisis gravida. Quisque ac finibus velit. Suspendisse sit amet erat sit amet lorem elementum feugiat ut eu elit. In hac habitasse platea dictumst. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer eros elit, consectetur et pretium vitae, convallis vel dui. Nulla maximus nunc a leo auctor, eu hendrerit augue accumsan. Vestibulum eleifend, mi at convallis sollicitudin, dolor lectus lacinia magna, id ullamcorper purus neque eget neque. Nullam vehicula, nisi et interdum hendrerit, lacus ante gravida neque, sit amet volutpat lacus nisi vitae turpis. Nam vel dui a tellus facilisis volutpat. Morbi dignissim venenatis enim, ac dictum magna pellentesque ullamcorper. Nam imperdiet erat nec pellentesque cursus. Cras vel elit pharetra, condimentum magna sed, rhoncus lorem. Aenean nec ipsum eu nunc lacinia sodales id suscipit dolor.
|
||||||
|
|
||||||
|
Fusce a suscipit felis. Nullam condimentum vel urna nec egestas. Curabitur vehicula leo sit amet scelerisque interdum. Morbi ut ultrices tellus. Nunc eleifend, lectus non euismod fermentum, sem libero lacinia augue, sollicitudin rutrum est nunc sed velit. In hac habitasse platea dictumst. Mauris placerat, mi non ornare bibendum, mauris dolor vehicula ante, vitae viverra elit tortor in enim. Proin lectus mi, luctus nec sem id, dignissim rhoncus ipsum. Proin pharetra, velit ac suscipit efficitur, nisi dui dictum mauris, at ultrices ligula eros et diam. Integer lacinia sapien in odio feugiat lacinia. Sed eleifend, enim eu sagittis hendrerit, mi sapien tristique massa, semper rhoncus metus libero sed purus. Vestibulum efficitur, elit sed dictum convallis, nisi turpis dictum justo, ac semper magna felis sed ex. Ut aliquet enim vitae turpis imperdiet, sed pretium nisi commodo. Proin fringilla auctor pretium. Fusce varius dui id nunc euismod, sed varius nulla tempor.
|
||||||
|
|
||||||
|
Vivamus venenatis porta lacus, ac porta ipsum tristique sed. Quisque porttitor elit nec aliquet vehicula. Sed ac ligula mi. Duis purus libero, accumsan id vestibulum vitae, maximus ut erat. Quisque facilisis convallis sapien, et suscipit sapien placerat ut. Sed eleifend risus non eros blandit, eu interdum est egestas. Donec egestas, magna a viverra porta, lectus libero porttitor quam, sit amet mattis libero mauris eu lorem. Donec sollicitudin faucibus lectus, non sodales risus sollicitudin in. Pellentesque vestibulum porttitor ipsum, eget tincidunt elit vestibulum ut. Donec gravida sollicitudin enim et venenatis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent rhoncus magna non volutpat dapibus.
|
||||||
|
|
||||||
|
Nunc quis varius ligula. Ut at ligula convallis, cursus lacus vitae, lobortis arcu. Vivamus nisl lacus, finibus vitae neque vel, luctus faucibus est. Etiam tortor arcu, elementum porta orci tempus, ultricies porta felis. Nullam tellus mi, vulputate sed ante auctor, condimentum consectetur nulla. Aliquam erat volutpat. In sed tristique arcu. Ut blandit dolor in augue vestibulum, sed sollicitudin nisl vestibulum. Quisque magna eros, ornare a viverra sit amet, auctor a tortor. Morbi malesuada, orci at varius placerat, dolor nulla tincidunt magna, nec tincidunt risus urna id magna. Proin faucibus eros metus, sit amet eleifend risus hendrerit sit amet. Nulla in lectus sed est vulputate vehicula quis sed turpis. Curabitur lobortis lectus mattis augue ultrices vehicula. Vestibulum accumsan dictum quam, et feugiat elit.
|
||||||
|
|
||||||
|
Donec commodo eleifend nulla in eleifend. Etiam consectetur lobortis ligula, vel porttitor nibh molestie eget. Sed bibendum, augue vel rhoncus imperdiet, lorem tellus pretium dui, dignissim tincidunt sapien ligula eu nisi. Sed aliquet lacus et purus sodales fermentum. In ex risus, iaculis ut nibh sed, dictum lacinia sapien. Praesent gravida laoreet volutpat. Duis laoreet ligula et libero dignissim tincidunt. Vivamus at mollis lorem, ut laoreet sapien. Nam sem lectus, viverra et maximus vitae, porttitor ut quam.
|
||||||
|
|
||||||
|
Etiam eleifend sem nibh, non euismod ex finibus at. Etiam maximus orci dolor, eu tristique risus venenatis quis. Mauris dignissim ligula quis arcu egestas sollicitudin. Ut ac lacus id velit pellentesque aliquam. Suspendisse pellentesque quam eget venenatis malesuada. Fusce mauris libero, finibus et nisi id, ornare convallis orci. Quisque laoreet, justo non porttitor eleifend, lorem eros tincidunt erat, a eleifend tortor mi eget augue. Sed ligula orci, aliquet ut egestas non, iaculis sed dolor. Aliquam augue nunc, elementum eu sapien vel, ornare vestibulum dui. Etiam cursus lacus in maximus commodo.
|
||||||
|
|
||||||
|
Fusce nibh enim, rutrum condimentum finibus sit amet, mattis id mi. Curabitur sed aliquet sapien, quis aliquet mauris. Morbi ut sem venenatis, eleifend nisl ut, pellentesque augue. Mauris eleifend, eros non fermentum placerat, lectus quam finibus augue, rutrum suscipit neque purus a ipsum. Nulla nec commodo odio. Phasellus bibendum a justo blandit venenatis. Ut id dignissim leo. Quisque nec eleifend justo.
|
||||||
|
|
||||||
|
Fusce scelerisque odio eget molestie ullamcorper. Suspendisse a ligula commodo libero consectetur fermentum ac vel tortor. Mauris malesuada massa nec ultrices bibendum. Fusce sit amet augue nec erat mattis vulputate. Vestibulum venenatis nisi tortor, sit amet viverra nunc laoreet ac. Integer dignissim nisi non sagittis rhoncus. Donec interdum urna vitae nunc lobortis condimentum. Nulla quis tincidunt metus, ut volutpat nisl. Nullam nec eleifend ante. Phasellus a ligula quis lorem venenatis lacinia eget eu magna. Fusce blandit vitae risus a interdum. Donec accumsan massa sit amet lobortis mattis.
|
||||||
|
|
||||||
|
Nullam congue, neque quis aliquam auctor, nulla justo mattis tellus, a fringilla ante metus accumsan sapien. Vivamus fermentum lectus tortor, fringilla vestibulum arcu suscipit non. Nullam malesuada laoreet blandit. Curabitur est quam, rutrum sed interdum vitae, varius vitae turpis. Sed sed consequat ligula. Mauris iaculis nunc at ex viverra, ac molestie ex dapibus. Proin placerat tellus lorem, in malesuada tortor rutrum quis. Ut semper lacus id ornare placerat. Nullam eget laoreet tellus. Sed commodo facilisis suscipit. Phasellus quis tincidunt ex. Aliquam maximus faucibus rhoncus. Sed sollicitudin et urna eget pulvinar. Quisque condimentum rutrum ligula vel pellentesque.
|
||||||
|
|
||||||
|
Fusce convallis velit ut risus fringilla efficitur. Ut pulvinar ultricies mi vitae elementum. Pellentesque eleifend arcu sed est tincidunt convallis. Pellentesque justo ipsum, ultricies ac sapien pulvinar, tincidunt maximus neque. Aliquam tempus luctus arcu. Vestibulum ornare scelerisque ligula, ac maximus turpis mollis vitae. Aliquam lobortis ultricies ultricies. Nunc scelerisque faucibus purus, quis placerat ipsum vulputate in. Sed scelerisque mauris sem, ut convallis risus efficitur sit amet. Fusce sed massa id metus feugiat venenatis non eget massa. Sed sagittis accumsan vulputate. Sed fermentum lacinia risus, in cursus risus scelerisque at. Pellentesque imperdiet risus pharetra dolor egestas, id faucibus purus posuere.
|
||||||
|
|
||||||
|
Curabitur faucibus sapien diam, vel placerat velit lacinia a. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras accumsan scelerisque magna ut ultricies. Nunc auctor dapibus est nec aliquet. Nunc et nulla id erat ultrices tempor nec ut tellus. Cras tempus, tortor ac vulputate aliquet, neque sapien elementum urna, quis vestibulum tellus tortor non tortor. Maecenas egestas urna bibendum lorem egestas eleifend. Aliquam id feugiat ante. Pellentesque rutrum interdum justo vitae feugiat. In mattis nisi ut justo rutrum, a viverra metus porttitor.
|
||||||
|
|
||||||
|
Praesent elementum, metus et dignissim molestie, velit nulla convallis nibh, placerat elementum lorem odio ac tellus. Nulla interdum enim id elit sodales accumsan. Suspendisse lorem enim, blandit a tortor nec, placerat gravida elit. Integer viverra, urna a placerat iaculis, odio nibh pellentesque diam, a vulputate turpis erat ac turpis. Ut pulvinar arcu at ipsum scelerisque viverra. Praesent tempor at tellus nec dapibus. Ut quis sodales ligula. Fusce a leo ex. Vestibulum commodo eu dolor sit amet pellentesque.
|
||||||
|
|
||||||
|
Vestibulum consequat eleifend purus, eu viverra metus tempor quis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean at sodales ante. Sed arcu nisl, sollicitudin quis convallis ut, mattis id augue. Proin velit arcu, fringilla at metus ac, pharetra eleifend orci. Curabitur magna est, lobortis ut magna sed, sagittis bibendum ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed sapien quam, ornare non tempor in, fringilla nec velit. Morbi condimentum enim nisl, ut pharetra massa placerat in.
|
BIN
examples/loremipsum.txt.c1
Normal file
BIN
examples/loremipsum.txt.c1
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c2
Normal file
BIN
examples/loremipsum.txt.c2
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c3
Normal file
BIN
examples/loremipsum.txt.c3
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c4
Normal file
BIN
examples/loremipsum.txt.c4
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c5
Normal file
BIN
examples/loremipsum.txt.c5
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c6
Normal file
BIN
examples/loremipsum.txt.c6
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c7
Normal file
BIN
examples/loremipsum.txt.c7
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c8
Normal file
BIN
examples/loremipsum.txt.c8
Normal file
Binary file not shown.
BIN
examples/loremipsum.txt.c9
Normal file
BIN
examples/loremipsum.txt.c9
Normal file
Binary file not shown.
1
examples/loremipsum.txt.chp
Normal file
1
examples/loremipsum.txt.chp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Cleaver><Original>loremipsum.txt</Original><Split part-size="1024" parts="31" total-size="31"/><Compress/></Cleaver>
|
|
@ -6,4 +6,7 @@ package eu.steffo.cleaver.errors;
|
||||||
* It is thrown when an exception that should never be thrown is caught, such as {@link javax.xml.parsers.ParserConfigurationException}.
|
* It is thrown when an exception that should never be thrown is caught, such as {@link javax.xml.parsers.ParserConfigurationException}.
|
||||||
*/
|
*/
|
||||||
public class ProgrammingError extends Exception {
|
public class ProgrammingError extends Exception {
|
||||||
|
public ProgrammingError(String s) {
|
||||||
|
super(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,6 @@ public class SplitRow extends OptionRow {
|
||||||
if(!splitCheckBox.isSelected()) {
|
if(!splitCheckBox.isSelected()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//TODO: catch exception here and display an error
|
|
||||||
else if(!sizeTextField.getText().equals("")) {
|
else if(!sizeTextField.getText().equals("")) {
|
||||||
return new SplitBySizeConfig(Integer.parseInt(sizeTextField.getText()), fileSize);
|
return new SplitBySizeConfig(Integer.parseInt(sizeTextField.getText()), fileSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import eu.steffo.cleaver.logic.crypt.CryptConfig;
|
||||||
import eu.steffo.cleaver.logic.crypt.CryptOutputStream;
|
import eu.steffo.cleaver.logic.crypt.CryptOutputStream;
|
||||||
import eu.steffo.cleaver.logic.progress.ErrorProgress;
|
import eu.steffo.cleaver.logic.progress.ErrorProgress;
|
||||||
import eu.steffo.cleaver.logic.progress.FinishedProgress;
|
import eu.steffo.cleaver.logic.progress.FinishedProgress;
|
||||||
|
import eu.steffo.cleaver.logic.progress.Progress;
|
||||||
import eu.steffo.cleaver.logic.progress.WorkingProgress;
|
import eu.steffo.cleaver.logic.progress.WorkingProgress;
|
||||||
import eu.steffo.cleaver.logic.split.SplitConfig;
|
import eu.steffo.cleaver.logic.split.SplitConfig;
|
||||||
import eu.steffo.cleaver.logic.split.SplitFileOutputStream;
|
import eu.steffo.cleaver.logic.split.SplitFileOutputStream;
|
||||||
|
@ -32,6 +33,15 @@ public class ChopJob extends Job {
|
||||||
private final CryptConfig cryptConfig;
|
private final CryptConfig cryptConfig;
|
||||||
private final CompressConfig compressConfig;
|
private final CompressConfig compressConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new ChopJob (with progress updates support).
|
||||||
|
* @param file The file to be chopped.
|
||||||
|
* @param splitConfig The configuration for the split step.
|
||||||
|
* @param cryptConfig The configuration for the crypt step.
|
||||||
|
* @param compressConfig The configuration for the compress step.
|
||||||
|
* @param onProgressChange A {@link Runnable} that should be invoked when {@link #setProgress(Progress)} is called.
|
||||||
|
* @see Job#Job(Runnable)
|
||||||
|
*/
|
||||||
public ChopJob(File file, SplitConfig splitConfig, CryptConfig cryptConfig, CompressConfig compressConfig, Runnable onProgressChange) {
|
public ChopJob(File file, SplitConfig splitConfig, CryptConfig cryptConfig, CompressConfig compressConfig, Runnable onProgressChange) {
|
||||||
super(onProgressChange);
|
super(onProgressChange);
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
@ -40,11 +50,19 @@ public class ChopJob extends Job {
|
||||||
this.compressConfig = compressConfig;
|
this.compressConfig = compressConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new ChopJob (without progress updates support).
|
||||||
|
* @param file The file to be chopped.
|
||||||
|
* @param splitConfig The configuration for the split step.
|
||||||
|
* @param cryptConfig The configuration for the crypt step.
|
||||||
|
* @param compressConfig The configuration for the compress step.
|
||||||
|
* @see ChopJob#ChopJob(File, SplitConfig, CryptConfig, CompressConfig, Runnable)
|
||||||
|
* @see Job#Job()
|
||||||
|
*/
|
||||||
public ChopJob(File file, SplitConfig splitConfig, CryptConfig cryptConfig, CompressConfig compressConfig) {
|
public ChopJob(File file, SplitConfig splitConfig, CryptConfig cryptConfig, CompressConfig compressConfig) {
|
||||||
this(file, splitConfig, cryptConfig, compressConfig, null);
|
this(file, splitConfig, cryptConfig, compressConfig, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "Chop";
|
return "Chop";
|
||||||
|
@ -88,7 +106,7 @@ public class ChopJob extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cryptConfig != null) {
|
if(cryptConfig != null) {
|
||||||
outputStream = new CryptOutputStream(outputStream);
|
outputStream = new CryptOutputStream(outputStream, cryptConfig.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create the .chp file
|
//Create the .chp file
|
||||||
|
@ -97,7 +115,7 @@ public class ChopJob extends Job {
|
||||||
try {
|
try {
|
||||||
builder = factory.newDocumentBuilder();
|
builder = factory.newDocumentBuilder();
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
throw new ProgrammingError();
|
throw new ProgrammingError("Parser configuration error in the ChopJob.");
|
||||||
}
|
}
|
||||||
Document doc = builder.newDocument();
|
Document doc = builder.newDocument();
|
||||||
Element root = doc.createElement("Cleaver");
|
Element root = doc.createElement("Cleaver");
|
||||||
|
|
|
@ -27,7 +27,7 @@ public abstract class Job extends Thread {
|
||||||
/**
|
/**
|
||||||
* Construct a Job, then add to it a {@link Runnable} that will be invoked through {@link SwingUtilities#invokeLater(Runnable) invokeLater} on progress
|
* Construct a Job, then add to it a {@link Runnable} that will be invoked through {@link SwingUtilities#invokeLater(Runnable) invokeLater} on progress
|
||||||
* changes.
|
* changes.
|
||||||
* @param onProgressChange The {@link Runnable} that should be invoked when {@link #setProgress(Progress)} is called.
|
* @param onProgressChange A {@link Runnable} that should be invoked when {@link #setProgress(Progress)} is called.
|
||||||
* @see Job()
|
* @see Job()
|
||||||
*/
|
*/
|
||||||
public Job(Runnable onProgressChange) {
|
public Job(Runnable onProgressChange) {
|
||||||
|
@ -40,6 +40,8 @@ public abstract class Job extends Thread {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The name of the job type, such as "Chop" for a {@link ChopJob}.
|
* @return The name of the job type, such as "Chop" for a {@link ChopJob}.
|
||||||
|
*
|
||||||
|
* It will be displayed in the {@link eu.steffo.cleaver.gui.panels.JobsTablePanel}.
|
||||||
*/
|
*/
|
||||||
public abstract String getType();
|
public abstract String getType();
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,14 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.DeflaterInputStream;
|
import java.util.zip.DeflaterInputStream;
|
||||||
|
import java.util.zip.InflaterInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Job} that converts <i>chopped</i> (*.chp + *.cXX) files back into regular files.
|
* A {@link Job} that converts <i>chopped</i> (*.chp + *.cXX) files back into regular files.
|
||||||
*/
|
*/
|
||||||
public class StitchJob extends Job {
|
public class StitchJob extends Job {
|
||||||
private File resultFile;
|
private File resultFile;
|
||||||
|
private File chpFile;
|
||||||
private SplitConfig splitConfig = null;
|
private SplitConfig splitConfig = null;
|
||||||
private CryptConfig cryptConfig = null;
|
private CryptConfig cryptConfig = null;
|
||||||
private CompressConfig compressConfig = null;
|
private CompressConfig compressConfig = null;
|
||||||
|
@ -66,7 +68,8 @@ public class StitchJob extends Job {
|
||||||
*/
|
*/
|
||||||
public StitchJob(File chpFile, String cryptKey, Runnable updateTable) throws ChpFileError, ProgrammingError {
|
public StitchJob(File chpFile, String cryptKey, Runnable updateTable) throws ChpFileError, ProgrammingError {
|
||||||
super(updateTable);
|
super(updateTable);
|
||||||
parseChp(openChp(chpFile), cryptKey);
|
this.chpFile = chpFile;
|
||||||
|
parseChp(getChpFileDocument(chpFile), cryptKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,19 +97,26 @@ public class StitchJob extends Job {
|
||||||
return compressConfig;
|
return compressConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Document openChp(File file) throws ChpFileError, ProgrammingError {
|
/**
|
||||||
|
* Instantiate a new {@link Document} based on the contents of a *.chp file.
|
||||||
|
* @param file The *.chp {@link File} to create the document from.
|
||||||
|
* @return The created {@link Document}.
|
||||||
|
* @throws ChpFileError If the .chp does not exist, or is corrupt.
|
||||||
|
* @throws ProgrammingError It should never happen, as the parser should be already configured correctly.
|
||||||
|
*/
|
||||||
|
protected static Document getChpFileDocument(File file) throws ChpFileError, ProgrammingError {
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder builder;
|
DocumentBuilder builder;
|
||||||
try {
|
try {
|
||||||
builder = factory.newDocumentBuilder();
|
builder = factory.newDocumentBuilder();
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
throw new ProgrammingError();
|
throw new ProgrammingError("Parser configuration error in the ChopJob.");
|
||||||
}
|
}
|
||||||
Document doc;
|
Document doc;
|
||||||
try {
|
try {
|
||||||
doc = builder.parse(file);
|
doc = builder.parse(file);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
throw new ProgrammingError();
|
throw new ChpFileError("The .chp is corrupt!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ChpFileError("The .chp file does not exist anymore!");
|
throw new ChpFileError("The .chp file does not exist anymore!");
|
||||||
}
|
}
|
||||||
|
@ -114,12 +124,12 @@ public class StitchJob extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a {@link Document} and set {@link #splitConfig}, {@link #cryptConfig} and {@link #compressConfig} accordingly.
|
* Read a {@link Document} and set the {@link SplitConfig}, {@link CryptConfig} and {@link CompressConfig} of this job accordingly.
|
||||||
* @param doc The {@link Document} to be read.
|
* @param doc The {@link Document} to be read.
|
||||||
* @param cryptKey The encryption key to use in the {@link CryptConfig}.
|
* @param cryptKey The encryption key to use in the {@link CryptConfig}.
|
||||||
* @throws ChpFileError If there's an error while parsing the *.chp file.
|
* @throws ChpFileError If there's an error while parsing the *.chp file.
|
||||||
*/
|
*/
|
||||||
protected final void parseChp(Document doc, String cryptKey) throws ChpFileError {
|
protected void parseChp(Document doc, String cryptKey) throws ChpFileError {
|
||||||
Element root = doc.getDocumentElement();
|
Element root = doc.getDocumentElement();
|
||||||
|
|
||||||
NodeList originals = root.getElementsByTagName("Original");
|
NodeList originals = root.getElementsByTagName("Original");
|
||||||
|
@ -136,7 +146,8 @@ public class StitchJob extends Job {
|
||||||
throw new ChpFileError("No original filename found (<Original> tag)");
|
throw new ChpFileError("No original filename found (<Original> tag)");
|
||||||
}
|
}
|
||||||
Element original = (Element)originalNode;
|
Element original = (Element)originalNode;
|
||||||
resultFile = new File(original.getTextContent());
|
//The resulting file will be in the same directory of the *.chp file
|
||||||
|
resultFile = new File(chpFile.getAbsoluteFile().getParentFile().getAbsolutePath().concat("/" + original.getTextContent()));
|
||||||
|
|
||||||
if(splitNode != null) {
|
if(splitNode != null) {
|
||||||
Element split = (Element)splitNode;
|
Element split = (Element)splitNode;
|
||||||
|
@ -176,17 +187,17 @@ public class StitchJob extends Job {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream;
|
InputStream inputStream;
|
||||||
OutputStream outputStream = new FileOutputStream(resultFile.getAbsolutePath());
|
OutputStream outputStream = new FileOutputStream(resultFile);
|
||||||
|
|
||||||
if (splitConfig != null) {
|
if (splitConfig != null) {
|
||||||
inputStream = new SplitFileInputStream(resultFile.getAbsolutePath(), splitConfig.getPartSize());
|
inputStream = new SplitFileInputStream(resultFile.getPath(), splitConfig.getPartSize());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
inputStream = new FileInputStream(String.format("%s.c00", resultFile.getAbsolutePath()));
|
inputStream = new FileInputStream(String.format("%s.c00", resultFile.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compressConfig != null) {
|
if (compressConfig != null) {
|
||||||
inputStream = new DeflaterInputStream(inputStream);
|
inputStream = new InflaterInputStream(inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cryptConfig != null) {
|
if (cryptConfig != null) {
|
||||||
|
@ -202,7 +213,7 @@ public class StitchJob extends Job {
|
||||||
outputStream.write(i);
|
outputStream.write(i);
|
||||||
bytesUntilNextUpdate -= 1;
|
bytesUntilNextUpdate -= 1;
|
||||||
if(bytesUntilNextUpdate <= 0) {
|
if(bytesUntilNextUpdate <= 0) {
|
||||||
//TODO: progress logic
|
this.setProgress(new WorkingProgress((float)(resultFile.length() - inputStream.available()) / (float)resultFile.length()));
|
||||||
bytesUntilNextUpdate = 2048;
|
bytesUntilNextUpdate = 2048;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package eu.steffo.cleaver.logic.crypt;
|
package eu.steffo.cleaver.logic.crypt;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
import java.io.FilterInputStream;
|
import java.io.FilterInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class CryptInputStream extends FilterInputStream {
|
public class CryptInputStream extends FilterInputStream {
|
||||||
|
|
||||||
public CryptInputStream(InputStream in) {
|
public CryptInputStream(InputStream in) {
|
||||||
super(in);
|
super(in);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,71 @@
|
||||||
package eu.steffo.cleaver.logic.crypt;
|
package eu.steffo.cleaver.logic.crypt;
|
||||||
|
|
||||||
|
import eu.steffo.cleaver.errors.ProgrammingError;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.io.FilterOutputStream;
|
import java.io.FilterOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
public class CryptOutputStream extends FilterOutputStream {
|
public class CryptOutputStream extends FilterOutputStream {
|
||||||
public CryptOutputStream(OutputStream out) {
|
private Cipher cipher;
|
||||||
super(out);
|
|
||||||
|
private final String algorithm;
|
||||||
|
private final String modeOfOperation;
|
||||||
|
private final String padding;
|
||||||
|
|
||||||
|
public String getAlgorithm() {
|
||||||
|
return algorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: This doesn't do anything... yet.
|
public String getModeOfOperation() {
|
||||||
|
return modeOfOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPadding() {
|
||||||
|
return padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTransformationString() {
|
||||||
|
return String.format("%s/%s/%s", algorithm, modeOfOperation, padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CryptOutputStream(OutputStream out, String key, String algorithm, String modeOfOperation, String padding) throws ProgrammingError {
|
||||||
|
super(out);
|
||||||
|
|
||||||
|
this.algorithm = algorithm;
|
||||||
|
this.modeOfOperation = modeOfOperation;
|
||||||
|
this.padding = padding;
|
||||||
|
|
||||||
|
//Setup the cipher object
|
||||||
|
try {
|
||||||
|
cipher = Cipher.getInstance(getTransformationString());
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
// This should never happen.
|
||||||
|
throw new ProgrammingError("Invalid algor specified in the CryptOutputStream.");
|
||||||
|
} catch (NoSuchPaddingException e) {
|
||||||
|
// This should never happen.
|
||||||
|
throw new ProgrammingError("Invalid padding specified in the CryptOutputStream.");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(), this.algorithm));
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
// This should never happen.
|
||||||
|
throw new ProgrammingError("Invalid key specified in the CryptOutputStream.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CryptOutputStream(OutputStream out, String key) throws ProgrammingError {
|
||||||
|
this(out, key, "AES", "CBC", "PKCS5Padding");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(int b) throws IOException {
|
||||||
|
//TODO
|
||||||
|
super.write(b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,26 @@
|
||||||
package eu.steffo.cleaver.logic.progress;
|
package eu.steffo.cleaver.logic.progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link Progress} that specifies that a {@link eu.steffo.cleaver.logic.Job} stopped because an exception occoured.
|
||||||
|
*/
|
||||||
public class ErrorProgress extends Progress {
|
public class ErrorProgress extends Progress {
|
||||||
public final Throwable error;
|
private final Throwable error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new ErrorProgress for a specific error.
|
||||||
|
* @param error The encountered error.
|
||||||
|
*/
|
||||||
public ErrorProgress(Throwable error) {
|
public ErrorProgress(Throwable error) {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The error encountered by the {@link eu.steffo.cleaver.logic.Job}.
|
||||||
|
*/
|
||||||
|
public Throwable getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Error: " + error.getMessage();
|
return "Error: " + error.getMessage();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.steffo.cleaver.logic.progress;
|
package eu.steffo.cleaver.logic.progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link Progress} that specifies that a {@link eu.steffo.cleaver.logic.Job} has finished.
|
||||||
|
*/
|
||||||
public class FinishedProgress extends Progress {
|
public class FinishedProgress extends Progress {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.steffo.cleaver.logic.progress;
|
package eu.steffo.cleaver.logic.progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link Progress} that specifies that a {@link eu.steffo.cleaver.logic.Job} hasn't started yet.
|
||||||
|
*/
|
||||||
public class NotStartedProgress extends Progress {
|
public class NotStartedProgress extends Progress {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
package eu.steffo.cleaver.logic.progress;
|
package eu.steffo.cleaver.logic.progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The abstract Progress class.
|
||||||
|
*
|
||||||
|
* All subclasses <b>must</b> be immutable.
|
||||||
|
*/
|
||||||
public abstract class Progress {
|
public abstract class Progress {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
package eu.steffo.cleaver.logic.progress;
|
package eu.steffo.cleaver.logic.progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link Progress} that specifies that a {@link eu.steffo.cleaver.logic.Job} is currently running and has progressed to {@link #progress} %.
|
||||||
|
*/
|
||||||
public class WorkingProgress extends Progress {
|
public class WorkingProgress extends Progress {
|
||||||
public final float progress;
|
public final float progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new WorkingProgress at 0%.
|
||||||
|
*/
|
||||||
public WorkingProgress() {
|
public WorkingProgress() {
|
||||||
this.progress = 0f;
|
this.progress = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new WorkingProgress at a specific percentage.
|
||||||
|
* @param progress The job progress from 0.0f to 1.0f.
|
||||||
|
*/
|
||||||
public WorkingProgress(float progress) {
|
public WorkingProgress(float progress) {
|
||||||
this.progress = progress;
|
this.progress = progress;
|
||||||
}
|
}
|
||||||
|
|
4
src/eu/steffo/cleaver/logic/progress/package-info.java
Normal file
4
src/eu/steffo/cleaver/logic/progress/package-info.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/**
|
||||||
|
* A package containing all possible {@link eu.steffo.cleaver.logic.progress.Progress Progress} that a job can be in.
|
||||||
|
*/
|
||||||
|
package eu.steffo.cleaver.logic.progress;
|
|
@ -8,6 +8,7 @@ import org.w3c.dom.Element;
|
||||||
* A class containing the configuration for the split/merge step of a {@link eu.steffo.cleaver.logic.Job Job}.
|
* A class containing the configuration for the split/merge step of a {@link eu.steffo.cleaver.logic.Job Job}.
|
||||||
*/
|
*/
|
||||||
public abstract class SplitConfig {
|
public abstract class SplitConfig {
|
||||||
|
//TODO REBUILD ERRORS
|
||||||
/**
|
/**
|
||||||
* Create a {@link Element} representing this SplitConfig (to be used in *.chp metadata files).
|
* Create a {@link Element} representing this SplitConfig (to be used in *.chp metadata files).
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,21 +1,87 @@
|
||||||
package eu.steffo.cleaver.logic.split;
|
package eu.steffo.cleaver.logic.split;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class SplitFileInputStream extends InputStream {
|
public class SplitFileInputStream extends InputStream {
|
||||||
protected String fileBaseName;
|
private final String fileBaseName;
|
||||||
protected long partSize;
|
private long currentByteCount;
|
||||||
protected int currentFileCount;
|
private long maximumByteCount;
|
||||||
|
private int currentFileCount;
|
||||||
|
|
||||||
public SplitFileInputStream(String fileBaseName, long partSize) {
|
/**
|
||||||
|
* The {@link FileInputStream} this {@link InputStream} is currently reading from.
|
||||||
|
*/
|
||||||
|
protected FileInputStream currentFileInputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a SplitFileInputStream.
|
||||||
|
* @param fileBaseName The name of the files without the extension. If it is {@literal example}, the opened files will be {@literal example.c1}, {@literal example.c2}, and so on.
|
||||||
|
* @param maximumByteCount The number of bytes that should be read from a file before switching to the next one.
|
||||||
|
*/
|
||||||
|
public SplitFileInputStream(String fileBaseName, long maximumByteCount) {
|
||||||
this.fileBaseName = fileBaseName;
|
this.fileBaseName = fileBaseName;
|
||||||
this.partSize = partSize;
|
this.maximumByteCount = maximumByteCount;
|
||||||
|
this.currentByteCount = 0;
|
||||||
this.currentFileCount = 0;
|
this.currentFileCount = 0;
|
||||||
|
this.currentFileInputStream = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the following file in the sequence, and update the {@link #currentFileInputStream}.
|
||||||
|
* @throws IOException If for some reason the program cannot open the file.
|
||||||
|
*/
|
||||||
|
protected void createNextFileInputStream() throws IOException {
|
||||||
|
if(currentFileInputStream != null) {
|
||||||
|
currentFileInputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentFileCount += 1;
|
||||||
|
currentFileInputStream = new FileInputStream(String.format("%s.c%d", fileBaseName, currentFileCount));
|
||||||
|
currentByteCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
throw new IOException("Not implemented yet");
|
if(currentFileInputStream == null || currentByteCount >= maximumByteCount) {
|
||||||
|
createNextFileInputStream();
|
||||||
|
}
|
||||||
|
int result = currentFileInputStream.read();
|
||||||
|
currentByteCount += 1;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
currentFileInputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The name of the files without the extension. If it is {@literal example}, the opened files will be {@literal example.c1}, {@literal example.c2}, and so on.
|
||||||
|
*/
|
||||||
|
public String getFileBaseName() {
|
||||||
|
return fileBaseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The number of bytes that have already been read from the current file.
|
||||||
|
*/
|
||||||
|
public long getCurrentByteCount() {
|
||||||
|
return currentByteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The number of bytes that should be read from a file before switching to the next one.
|
||||||
|
*/
|
||||||
|
public long getMaximumByteCount() {
|
||||||
|
return maximumByteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The number of files that have already been read.
|
||||||
|
*/
|
||||||
|
public int getCurrentFileCount() {
|
||||||
|
return currentFileCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ public class SplitFileOutputStream extends OutputStream {
|
||||||
protected FileOutputStream currentFileOutputStream;
|
protected FileOutputStream currentFileOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param fileBaseName The name that the files without the extension. If it is {@literal example}, the created files will be {@literal example.c1}, {@literal example.c2}, and so on.
|
* Construct a SplitFileOutputStream.
|
||||||
|
* @param fileBaseName The name of the files without the extension. If it is {@literal example}, the created files will be {@literal example.c1}, {@literal example.c2}, and so on.
|
||||||
* @param maximumByteCount The number of bytes that should be written to a file before switching to the next one.
|
* @param maximumByteCount The number of bytes that should be written to a file before switching to the next one.
|
||||||
*/
|
*/
|
||||||
public SplitFileOutputStream(String fileBaseName, long maximumByteCount) {
|
public SplitFileOutputStream(String fileBaseName, long maximumByteCount) {
|
||||||
|
@ -61,7 +62,7 @@ public class SplitFileOutputStream extends OutputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The name that the files without the extension. If it is {@literal example}, the created files will be {@literal example.c1}, {@literal example.c2}, and so on.
|
* @return The name of the files without the extension. If it is {@literal example}, the created files will be {@literal example.c1}, {@literal example.c2}, and so on.
|
||||||
*/
|
*/
|
||||||
public String getFileBaseName() {
|
public String getFileBaseName() {
|
||||||
return fileBaseName;
|
return fileBaseName;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* A file compression, encryption and splitting utility in Java.
|
* A file compression, encryption and splitting utility in Java.
|
||||||
|
*
|
||||||
|
* It includes a easy to use {@link javax.swing} GUI.
|
||||||
*/
|
*/
|
||||||
open module eu.steffo.cleaver {
|
open module eu.steffo.cleaver {
|
||||||
requires java.desktop;
|
requires java.desktop;
|
||||||
|
|
Loading…
Reference in a new issue