1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
package imaging.framework;
import java.awt.*;
import java.io.*;
import JACE.OS.*;
import JACE.Connection.*;
public class GIFHandler extends BlobWriter
{
public GIFHandler (String filename, Image image, int length)
{
super (null, length, 0, filename);
this.image_ = image;
}
/******************************
* Used for HTTP 1.1 PUT authorization
*****************************/
public GIFHandler (String filename, Image image, int length, String authentication)
{
super (null, length, 0, filename, authentication);
this.image_ = image;
}
protected int sendRequest ()
{
if (this.sendHeader () == -1)
{
ACE.ERROR ("GIFHandler::sendHeader failed.");
return -1;
}
else
if (this.sendData () == -1)
{
ACE.ERROR ("GIFHandler::sendData failed.");
return -1;
}
return 0;
}
// Send the data
protected int sendData ()
{
try
{
if (this.length_ > 0)
{
OutputStream ostream = this.peer ().outputStream ();
this.encoder_ = new GifEncoder (this.image_, ostream);
this.encoder_.encode ();
// this.encoder_ = new GIFEncoder (this.image_);
// this.encoder_.Write (ostream);
}
this.bytesWritten_ = this.length_;
}
catch (IOException e)
{
ACE.ERROR ("Error writing to server");
}
return 0;
}
GifEncoder encoder_ = null;
// GIFEncoder encoder_ = null;
Image image_ = null;
}
|