-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
31 changed files
with
146 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
MyPokerLab.iml | ||
com.MyPokerLab.iml | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Model; | ||
package com.Model; | ||
|
||
public enum eRoom { | ||
Winamax; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Model; | ||
package com.Model; | ||
|
||
public enum eRound { | ||
antebinds, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.Utils; | ||
|
||
import com.Model.Hand; | ||
|
||
import javax.xml.bind.JAXBContext; | ||
import javax.xml.bind.JAXBException; | ||
import javax.xml.bind.Marshaller; | ||
import javax.xml.bind.Unmarshaller; | ||
import javax.xml.transform.stream.StreamResult; | ||
import javax.xml.transform.stream.StreamSource; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
|
||
/** | ||
* com.Utils in com.MyPokerLab | ||
* Made by Floran Pagliai <floran.pagliai@gmail.com> | ||
* Started on 20/05/15 at 11:36 | ||
*/ | ||
|
||
public class XMLConverter { | ||
private Marshaller marshaller; | ||
private Unmarshaller unmarshaller; | ||
|
||
public XMLConverter() throws JAXBException { | ||
JAXBContext jaxbContext = JAXBContext.newInstance(Hand.class); | ||
marshaller = jaxbContext.createMarshaller(); | ||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); | ||
unmarshaller = jaxbContext.createUnmarshaller(); | ||
} | ||
|
||
public Marshaller getMarshaller() { | ||
return marshaller; | ||
} | ||
|
||
public void setMarshaller(Marshaller marshaller) { | ||
this.marshaller = marshaller; | ||
} | ||
|
||
public Unmarshaller getUnmarshaller() { | ||
return unmarshaller; | ||
} | ||
|
||
public void setUnmarshaller(Unmarshaller unmarshaller) { | ||
this.unmarshaller = unmarshaller; | ||
} | ||
|
||
public void convertFromObjectToXML(Object object, String filepath) | ||
throws IOException { | ||
|
||
FileOutputStream os = null; | ||
try { | ||
os = new FileOutputStream(filepath); | ||
getMarshaller().marshal(object, new StreamResult(os)); | ||
} catch (JAXBException e) { | ||
e.printStackTrace(); | ||
} finally { | ||
if (os != null) { | ||
os.close(); | ||
} | ||
} | ||
} | ||
|
||
public Object convertFromXMLToObject(String xmlfile) throws IOException { | ||
|
||
FileInputStream is = null; | ||
try { | ||
is = new FileInputStream(xmlfile); | ||
return getUnmarshaller().unmarshal(new StreamSource(is)); | ||
} catch (JAXBException e) { | ||
e.printStackTrace(); | ||
} finally { | ||
if (is != null) { | ||
is.close(); | ||
} | ||
} | ||
return null; | ||
} | ||
} |