Re: Upomoc
Dana 14.6.2005 15:20, Zeljko Nase napisa:
Evo jednog segmenta, nadam se da ce ti pomoci...
To je kod iz dve klase, al cisto da vidis kako se "umotavaju" strimovi
OutputStream outputFile = null;
outputFile = new FileOutputStream( filename1 );
a.konvertuj(inputFile, outputFile, t);
public void konvertuj(InputStream input, OutputStream output, Tabela t) {
BufferedInputStream b_in = null;
BufferedOutputStream b_out = null;
DataOutputStream out = null;
b_in = new BufferedInputStream(input);
b_out = new BufferedOutputStream(output);
out = new DataOutputStream(b_out);
int ch;
try {
char p;
Integer c, x;
while((ch = b_in.read()) != -1) {
c = new Integer(ch);
if(t.exist(c)) {
if((p = grupe.get(new Integer(t.codeEntry(c)))) != 0)
out.writeByte(p);
else {
x = new Integer(t.codeEntry(c));
out.writeByte(t.entryCode(x));
}
}
}
} catch (Exception e) {
System.err.println("Izuzetak: " + e);
}
try {
out.close();
} catch (Exception ignored) {}
}
Srecno...
Pozdrav!
--
If age or weaknes doe prohibyte bloudletting, you must use boxing.
- PHILIP BARROUGH, The Methode of Phisicke (1583)
Da li neko moze da mi kaze kako da resim problem upisa generisanog bajtkoda iz niza koji je u klasi Code u fajl. Probao sam da koristim f-ju Code.write, ali ona kao parametar zahteva OutputStream koji je apstraktna klasa tako da ne znam sta da joj predam kao parametar.
Evo jednog segmenta, nadam se da ce ti pomoci...
To je kod iz dve klase, al cisto da vidis kako se "umotavaju" strimovi
OutputStream outputFile = null;
outputFile = new FileOutputStream( filename1 );
a.konvertuj(inputFile, outputFile, t);
public void konvertuj(InputStream input, OutputStream output, Tabela t) {
BufferedInputStream b_in = null;
BufferedOutputStream b_out = null;
DataOutputStream out = null;
b_in = new BufferedInputStream(input);
b_out = new BufferedOutputStream(output);
out = new DataOutputStream(b_out);
int ch;
try {
char p;
Integer c, x;
while((ch = b_in.read()) != -1) {
c = new Integer(ch);
if(t.exist(c)) {
if((p = grupe.get(new Integer(t.codeEntry(c)))) != 0)
out.writeByte(p);
else {
x = new Integer(t.codeEntry(c));
out.writeByte(t.entryCode(x));
}
}
}
} catch (Exception e) {
System.err.println("Izuzetak: " + e);
}
try {
out.close();
} catch (Exception ignored) {}
}
Srecno...
Pozdrav!
--
If age or weaknes doe prohibyte bloudletting, you must use boxing.
- PHILIP BARROUGH, The Methode of Phisicke (1583)
- Follow-Ups:
- Re: Upomoc
- From: "Marko Ninkovic" <ninchagora@beotel.yu>
- Re: Upomoc
- References:
- Upomoc
- From: Zeljko Nase <ZNase@Sezampro.yu>
- Upomoc
Previous by date: Upomoc
Next by date: Re: Upomoc
Previous by thread: Upomoc Next by thread: Re: Upomoc
Previous by thread: Upomoc Next by thread: Re: Upomoc