本文整理汇总了Java中org.telegram.mtproto.log.Logger.w方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.w方法的具体用法?Java Logger.w怎么用?Java Logger.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.mtproto.log.Logger
的用法示例。
在下文中一共展示了Logger.w方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readString
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public String readString(boolean exception) {
try {
int sl = 1;
int l = getIntFromByte(this.buffer.get());
if(l >= 254) {
l = getIntFromByte(this.buffer.get()) | (getIntFromByte(this.buffer.get()) << 8) | (getIntFromByte(this.buffer.get()) << 16);
sl = 4;
}
final byte[] b = new byte[l];
this.buffer.get(b);
int i = sl;
while(((l + i) % 4) != 0) {
this.buffer.get();
i++;
}
return new String(b, "UTF-8");
} catch (Exception e) {
if (exception) {
throw new RuntimeException("read string error", e);
} else {
Logger.w("tmessages", "read string error");
}
}
return null;
}
示例2: readByteArray
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public byte[] readByteArray(boolean exception) {
try {
int sl = 1;
int l = getIntFromByte(this.buffer.get());
if (l >= 254) {
l = getIntFromByte(this.buffer.get()) | (getIntFromByte(this.buffer.get()) << 8) | (getIntFromByte(this.buffer.get()) << 16);
sl = 4;
}
final byte[] b = new byte[l];
this.buffer.get(b);
int i = sl;
while(((l + i) % 4) != 0) {
this.buffer.get();
i++;
}
return b;
} catch (Exception e) {
if (exception) {
throw new RuntimeException("read byte array error", e);
} else {
Logger.w("tmessages", "read byte array error");
}
}
return null;
}
示例3: reuseFreeBuffer
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void reuseFreeBuffer(ByteBufferDesc buffer) {
if (buffer == null) {
return;
}
int maxCount = 10;
ArrayList<ByteBufferDesc> arrayToReuse = null;
if (buffer.buffer.capacity() == 128) {
arrayToReuse = freeBuffers128;
} else if (buffer.buffer.capacity() == 1024 + 200) {
arrayToReuse = freeBuffers1024;
} if (buffer.buffer.capacity() == 4096 + 200) {
arrayToReuse = freeBuffers4096;
} else if (buffer.buffer.capacity() == 16384 + 200) {
arrayToReuse = freeBuffers16384;
} else if (buffer.buffer.capacity() == 40000) {
arrayToReuse = freeBuffers32768;
} else if (buffer.buffer.capacity() == 280000) {
arrayToReuse = freeBuffersBig;
maxCount = 10;
}
if (arrayToReuse != null) {
if (isThreadSafe) {
synchronized (sync) {
if (arrayToReuse.size() < maxCount) {
arrayToReuse.add(buffer);
} else {
Logger.w("tmessages", "too more");
}
}
} else {
if (arrayToReuse.size() < maxCount) {
arrayToReuse.add(buffer);
}
}
}
}
示例4: writeInt32
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeInt32(int x) {
try {
if (this.justCalc) {
this.len += 4;
} else {
this.buffer.putInt(x);
}
} catch(Exception e) {
Logger.w("tmessages", "write int32 error");
}
}
示例5: writeInt64
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeInt64(long x) {
try {
if (this.justCalc) {
this.len += 8;
} else {
this.buffer.putLong(x);
}
} catch(Exception e) {
Logger.w("tmessages", "write int64 error");
}
}
示例6: writeRaw
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeRaw(byte[] b) {
try {
if (this.justCalc) {
this.len += b.length;
} else {
this.buffer.put(b);
}
} catch (Exception e) {
Logger.w("tmessages", "write raw error");
}
}
示例7: writeByte
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeByte(byte b) {
try {
if (this.justCalc) {
this.len += 1;
} else {
this.buffer.put(b);
}
} catch (Exception e) {
Logger.w("tmessages", "write byte error");
}
}
示例8: writeString
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeString(String s) {
try {
writeByteArray(s.getBytes("UTF-8"));
} catch(Exception e) {
Logger.w("tmessages", "write string error");
}
}
示例9: writeByteArray
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeByteArray(byte[] b, int offset, int count) {
try {
if(count <= 253) {
if (this.justCalc) {
this.len += 1;
} else {
this.buffer.put((byte) count);
}
} else {
if (this.justCalc) {
this.len += 4;
} else {
this.buffer.put((byte) 254);
this.buffer.put((byte) count);
this.buffer.put((byte) (count >> 8));
this.buffer.put((byte) (count >> 16));
}
}
if (this.justCalc) {
this.len += count;
} else {
this.buffer.put(b, offset, count);
}
int i = (count <= 253) ? 1 : 4;
while (((count + i) % 4) != 0) {
if (this.justCalc) {
this.len += 1;
} else {
this.buffer.put((byte) 0);
}
i++;
}
} catch (Exception e) {
Logger.w("tmessages", "write byte array error");
}
}
示例10: writeDouble
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeDouble(double d) {
try {
writeInt64(Double.doubleToRawLongBits(d));
} catch(Exception e) {
Logger.w("tmessages", "write double error");
}
}
示例11: readInt32
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public int readInt32(boolean exception) {
try {
return this.buffer.getInt();
} catch (Exception e) {
if (exception) {
throw new RuntimeException("read int32 error", e);
} else {
Logger.w("tmessages", "read int32 error");
}
}
return 0;
}
示例12: readBool
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public boolean readBool(boolean exception) {
int consructor = readInt32(exception);
if (consructor == 0x997275b5) {
return true;
}
if (consructor == 0xbc799737) {
return false;
}
if (exception) {
throw new RuntimeException("Not bool value!");
}
Logger.w("tmessages", "Not bool value!");
return false;
}
示例13: readInt64
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public long readInt64(boolean exception) {
try {
return this.buffer.getLong();
} catch (Exception e) {
if (exception) {
throw new RuntimeException("read int64 error", e);
} else {
Logger.w("tmessages", "read int64 error");
}
}
return 0;
}
示例14: readRaw
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void readRaw(byte[] b, boolean exception) {
try {
this.buffer.get(b);
} catch (Exception e) {
if (exception) {
throw new RuntimeException("read raw error", e);
} else {
Logger.w("tmessages", "read raw error");
}
}
}
示例15: readByteBuffer
import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public ByteBufferDesc readByteBuffer(boolean exception) {
try {
int sl = 1;
int l = getIntFromByte(this.buffer.get());
if (l >= 254) {
l = getIntFromByte(this.buffer.get()) | (getIntFromByte(this.buffer.get()) << 8) | (getIntFromByte(this.buffer.get()) << 16);
sl = 4;
}
final ByteBufferDesc b = BuffersStorage.getInstance().getFreeBuffer(l);
if (b != null) {
final int old = this.buffer.limit();
this.buffer.limit(this.buffer.position() + l);
b.buffer.put(this.buffer);
this.buffer.limit(old);
b.buffer.position(0);
}
int i = sl;
while(((l + i) % 4) != 0) {
this.buffer.get();
i++;
}
return b;
} catch (Exception e) {
if (exception) {
throw new RuntimeException("read byte array error", e);
} else {
Logger.w("tmessages", "read byte array error");
}
}
return null;
}