/**
* The name of the image segment
*/
- private String _name;
+ private String name;
/**
* The name of the image segment as EBCIDIC bytes
*/
- private byte[] _nameBytes;
+ private byte[] nameBytes;
/**
* The ImageContent for the image segment
*/
- private ImageContent _imageContent = null;
+ private ImageContent imageContent = null;
/**
* Default constructor for the ImageSegment.
*/
public ImageSegment() {
-
this(DEFAULT_NAME);
-
}
/**
throw new IllegalArgumentException(msg);
}
- _name = name;
+ this.name = name;
try {
-
- _nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
-
+ this.nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
} catch (UnsupportedEncodingException usee) {
-
- _nameBytes = name.getBytes();
+ this.nameBytes = name.getBytes();
log.warn(
"Constructor:: UnsupportedEncodingException translating the name "
+ name);
-
}
-
}
/**
* @param vsize The vertival size of the image.
*/
public void setImageSize(int hresol, int vresol, int hsize, int vsize) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageSize(hresol, vresol, hsize, vsize);
+ imageContent.setImageSize(hresol, vresol, hsize, vsize);
}
/**
* @param encoding The image encoding.
*/
public void setImageEncoding(byte encoding) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageEncoding(encoding);
+ imageContent.setImageEncoding(encoding);
}
/**
* @param compression The image compression.
*/
public void setImageCompression(byte compression) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageCompression(compression);
+ imageContent.setImageCompression(compression);
}
/**
* @param size The IDE size.
*/
public void setImageIDESize(byte size) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageIDESize(size);
+ imageContent.setImageIDESize(size);
}
/**
* @param colorModel the IDE color model.
*/
public void setImageIDEColorModel(byte colorModel) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageIDEColorModel(colorModel);
+ imageContent.setImageIDEColorModel(colorModel);
}
/**
* Set the data of the image.
* @param data the image data
*/
- public void setImageData(byte data[]) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ public void setImageData(byte[] data) {
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageData(data);
+ imageContent.setImageData(data);
}
/**
* Accessor method to write the AFP datastream for the Image Segment
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException if an I/O exception occurred
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
+ public void writeDataStream(OutputStream os) throws IOException {
writeStart(os);
- if (_imageContent != null) {
- _imageContent.writeDataStream(os);
+ if (imageContent != null) {
+ imageContent.writeDataStream(os);
}
writeEnd(os);
0x00, // Name byte 4
};
- for (int i = 0; i < _nameBytes.length; i++) {
+ for (int i = 0; i < nameBytes.length; i++) {
- data[2 + i] = _nameBytes[i];
+ data[2 + i] = nameBytes[i];
}
* Helper method to write the end of the Image Segment.
* @param os The stream to write to
*/
- private void writeEnd(OutputStream os)
- throws IOException {
+ private void writeEnd(OutputStream os) throws IOException {
byte[] data = new byte[] {
0x71, // ID
0x00, // Length
};
-
os.write(data);
-
}
-
}