|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectppt.ImageStreamer
public class ImageStreamer
The ImageStreamer class is used as client in ImageServer. The class main functionality is to receive PNG file as BufferedImage, divide the image by squares. The square then get compared with the previous ones from the same location. The new square gets sent to the client via real time protocol - RTP
Field Summary | |
---|---|
(package private) java.awt.image.BufferedImage |
image
|
(package private) int |
imageHeight
|
(package private) int |
imageWidth
|
(package private) boolean |
initialized
|
(package private) static org.apache.log4j.Logger |
logger
|
(package private) int |
numOfCols
|
(package private) int |
numOfRows
|
(package private) java.io.OutputStream |
out
|
(package private) static int |
tileHeight
|
(package private) java.lang.Object[] |
tiles
|
(package private) static int |
tileWidth
|
Constructor Summary | |
---|---|
ImageStreamer(java.io.OutputStream socketOutputStream,
java.awt.image.BufferedImage bufImage)
Constructor which is used for each client to open a window, initialize an array for storing squares with dimensions according to the first image recived. |
Method Summary | |
---|---|
byte[] |
createPacketHeader(int code,
int id,
int length,
boolean isMarker)
The method creates header as byte array |
byte[] |
createWindowDimensions(byte[] b,
int left,
int top,
int width,
int heigth,
int x)
The method adds creates dimensions for window in byte array It is used in packets for resizing a window (code 2) |
byte[] |
dataPacket(byte[] buffer,
int l,
int t,
int w,
int h,
boolean isMarker)
THe method creates packet with data. |
boolean |
equals(byte[] array1,
byte[] array2)
The method compares two subimages as byte arrays |
byte[] |
imageToByteArray(java.awt.image.BufferedImage bi)
The method gets BufferedImage as byte array |
byte[] |
openWindowPacket()
The method opens a window (code 0) |
byte[] |
resizeWindowPacket()
The method resizes window (code 2) |
void |
sendImage()
The method gets splits image on squares. |
void |
setImage(java.awt.image.BufferedImage bufImage)
The method sets image for every new png created file and sends the image to client |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static org.apache.log4j.Logger logger
java.io.OutputStream out
boolean initialized
java.awt.image.BufferedImage image
int imageWidth
int imageHeight
static int tileWidth
static int tileHeight
java.lang.Object[] tiles
int numOfCols
int numOfRows
Constructor Detail |
---|
public ImageStreamer(java.io.OutputStream socketOutputStream, java.awt.image.BufferedImage bufImage)
socketOutputStream
- as OutputStreambufImage
- as BufferedImageMethod Detail |
---|
public void setImage(java.awt.image.BufferedImage bufImage)
bufImage
- as BufferedImagepublic void sendImage() throws java.io.IOException
java.io.IOException
public byte[] openWindowPacket()
public byte[] resizeWindowPacket()
public byte[] dataPacket(byte[] buffer, int l, int t, int w, int h, boolean isMarker)
buffer
- contained subimagel
- - left position for the subimaget
- - top position for the subimagew
- - width of of subimageh
- - height of the subimageisMarker
- is true for each packet
public byte[] createPacketHeader(int code, int id, int length, boolean isMarker)
code
- id
- length
- isMarker
-
public byte[] createWindowDimensions(byte[] b, int left, int top, int width, int heigth, int x)
b
- - byte arrayleft
- top
- width
- heigth
- x
- - position in byte array which starts after header end position
public byte[] imageToByteArray(java.awt.image.BufferedImage bi)
bi
- as BufferedImage
public boolean equals(byte[] array1, byte[] array2)
array1
- as byte arrayarray2
- as byte array
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |