This file contains hidden or 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
class Feito{ | |
public static void main(String[] args){ | |
System.out.println("feito"); | |
} | |
} |
This file contains hidden or 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
public class WriteByFileOutputStream { | |
public static void main (String[] args){ | |
byte[] b = new byte[1024]; | |
File outFile = new File("test.bin"); | |
OutputStream out = new FileOutputStream(outFile); | |
out.write(b); | |
out.close(); | |
} |
This file contains hidden or 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
import java.io.DataOutputStream; | |
import java.net.Socket; | |
public class ClienteSockets { | |
private String host; | |
private int porta; | |
public ClienteSockets(String host, int porta) { | |
this.host = host; | |
this.porta = porta; | |
} | |
public boolean comunicar(String msg) { |
This file contains hidden or 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
import java.io.DataInputStream; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
public class ServidorSockets { | |
private int porta; | |
public ServidorSockets(int porta) { | |
this.porta = porta; | |
} | |
public boolean iniciar() { | |
boolean commOK = true; |
This file contains hidden or 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
class WriteByFileWriter { | |
public static void main(String[] args){ | |
char[] charArray = new char[1024]; | |
File outFile = new File("test.txt"); | |
FileWriter fw = new FileWriter(outFile); | |
for (byte c : charArray ) { | |
fw.write(c); | |
} | |
fw.close(); | |
} |
This file contains hidden or 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
package com.poc.pojo; | |
import java.io.Serializable; | |
public class Aluno implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private String cicloDeIngresso; | |
private String id; | |
private String nome; |
This file contains hidden or 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
public class Marshal { | |
private static String fileName = "objetoPessoa.xml"; | |
public void marshal() throws JAXBException, IOException{ | |
JAXBContext jc = JAXBContext.newInstance( "org.example.pessoa" ); | |
PessoaData zehFirmino = new PessoaData(); | |
zehFirmino.setNome("Zeh Firmino"); | |
Endereco endereco = new Endereco(); | |
endereco.setCidade("Porto Alegre"); | |
endereco.setRua("Rua da Praia"); |
This file contains hidden or 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
public class Unmarshal { | |
private static String fileName = "objetoPessoa.xml"; | |
public void unmarshal() throws JAXBException, FileNotFoundException{ | |
JAXBContext jc = JAXBContext.newInstance( "org.example.pessoa" ); | |
Unmarshaller unmarshaller = jc.createUnmarshaller(); | |
JAXBElement<PessoaData> pessoaRoot = (JAXBElement<PessoaData>)unmarshaller.unmarshal(new FileReader(fileName)); | |
PessoaData pessoa = pessoaRoot.getValue(); | |
System.out.printf("%s - %s - %s",pessoa.getNome(),pessoa.getEndereco(),pessoa.getTelefones().getTelefone()); | |
} |
This file contains hidden or 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
echo off | |
echo. | |
echo Gerando classes apartir do schema | |
echo ================================= | |
xjc -verbose -d .. pessoa.xsd | |
echo ======================== | |
echo Processamento finalizado |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/pessoa" | |
xmlns:tns="http://www.example.org/pessoa" elementFormDefault="qualified"> | |
<complexType name="endereco"> | |
<sequence> | |
<element name="rua" type="string"></element> | |
<element name="numero" type="int"></element> | |
<element name="cidade" type="string"></element> | |
</sequence> |
OlderNewer