mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-09 08:52:51 +00:00
Change-Id: I04b40ac9094ed82a87bba234191ea0b8db67c718
This commit is contained in:
@@ -4,7 +4,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
public class BufferUtil {
|
||||
public class BufferUtils {
|
||||
public static final String readString(ChannelBuffer buffer) {
|
||||
char[] str = new char[buffer.readableBytes()];
|
||||
int index = 0;
|
||||
@@ -16,10 +16,12 @@ public class BufferUtil {
|
||||
}
|
||||
|
||||
public static final void writeString(ChannelBuffer buffer, String str) {
|
||||
if (str != null)
|
||||
for (char c : str.toCharArray()) {
|
||||
buffer.writeChar(c);
|
||||
if (str != null) {
|
||||
final int len = str.length();
|
||||
for (int i = 0; i < len; i++) {
|
||||
buffer.writeChar(str.charAt(i));
|
||||
}
|
||||
}
|
||||
buffer.writeChar('\000');
|
||||
}
|
||||
}
|
||||
@@ -14,27 +14,31 @@ public class RGBColor {
|
||||
/**
|
||||
* @return the red
|
||||
*/
|
||||
public byte getR() {
|
||||
public byte getRed() {
|
||||
return red;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the green
|
||||
*/
|
||||
public byte getG() {
|
||||
public byte getGreen() {
|
||||
return green;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the blue
|
||||
*/
|
||||
public byte getB() {
|
||||
public byte getBlue() {
|
||||
return blue;
|
||||
}
|
||||
|
||||
public byte[] toByteArray() {
|
||||
return new byte[] { red, green, blue };
|
||||
}
|
||||
|
||||
public int toInteger() {
|
||||
return red + green >> 8 + blue >> 16;
|
||||
}
|
||||
|
||||
public static RGBColor fromByteArray(byte[] rgb) {
|
||||
return new RGBColor(rgb[0], rgb[1], rgb[2]);
|
||||
|
||||
Reference in New Issue
Block a user