JVM byte code

发布时间:2019-05-04  栏目:Python  评论:0 Comments

浮动方法

http://java-performance.info/string-intern-java-6-7-8-multithreaded-access/

 

http://blog.jamesdbloom.com/JVMInternals.html#constant_pool

using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;

http://stackoverflow.com/questions/10209952/what-is-the-purpose-of-the-java-constant-pool

return stream.ToArray();
}
finally
{
g.Dispose();
image.Dispose();
}
}

http://stackoverflow.com/questions/23252767/string-pool-vs-constant-pool

引用命名空间

http://blog.jamesdbloom.com/JavaCodeToByteCode_PartOne.html

/// <summary>生成验证码
/// </summary>
/// <returns></returns>
public string GetCheckCode()
{
int number;
char code;
string checkCode = String.Empty;

http://stackoverflow.com/questions/5546280/understanding-javaps-output-for-the-constant-pool

byte[] bytes = CreateValidateGraphic(checkCode.ToLower());
var response = new BaseResponse<string>();
var src = “data:image/jpeg;base64,” +
Convert.ToBase6四String(bytes);//Base6四调换 HTML标签img 直接突显 <img
src=”” />
return src;
}

http://stackoverflow.com/questions/1281549/memory-leak-traps-in-the-java-standard-api/1281569#1281569

/// <summary>
/// 创立验证码的图纸
/// </summary>
/// <param name=”containsPage”></param>
/// <param name=”validateNum”></param>
public static byte[] CreateValidateGraphic(string checkCode)
{
Bitmap image = new Bitmap((int)Math.Ceiling(checkCode.Length * 13.5),
22);
Graphics g = Graphics.FromImage(image);
try
{
//生成随机生成器
Random random = new Random();
//清空图片背景观
g.Clear(Color.White);
//画图纸的苦恼线
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width); int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
Font font = new Font(“Arial”, 12, (FontStyle.Bold |
FontStyle.Italic));
LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0,
image.Width, image.Height),
Color.Blue, Color.DarkRed, 1.2f, true); g.DrawString(checkCode, font,
brush, 3, 2);
//画图纸的前景苦恼点
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width); int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
//画图纸的边框线
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width – 1,
image.Height – 1);
//保存图片数据
MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Jpeg);
//输出图片

http://stackoverflow.com/questions/11700320/is-string-literal-pool-a-collection-of-references-to-the-string-object-or-a-col/11701016#11701016

System.Random random = new Random();
do
{
number = random.Next();
if (number % 2 == 0)
code = (char)(‘0’ + (char)(number % 10));
else
code = (char)(‘A’ + (char)(number % 26));
if (code == ‘o’ || code == ‘O’) continue;
checkCode += code.ToString();
} while (checkCode.Length < 4);
//code储存.在session
KMHC.Infrastructure.SessionHelper.SetSession(“checkCode”,
checkCode.ToUpper());

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/lang/String.java#String.%3Cinit%3E%28java.lang.String%29

 

http://rednaxelafx.iteye.com/blog/1042464

http://jimlife.wordpress.com/2007/08/10/java-constant-pool-string/

http://rednaxelafx.iteye.com/blog/729214

http://www.javaranch.com/journal/200409/Journal200409.jsp#a1

http://rednaxelafx.iteye.com/blog/774673

http://theopentutorials.com/tutorials/java/strings/string-literal-pool/

http://rednaxelafx.iteye.com/blog/1969833

http://www.iteye.com/topic/522167

https://dzone.com/articles/string-memory-internals

http://java-performance.info/string-intern-in-java-6-7-8/

http://rednaxelafx.iteye.com/blog/1969861

http://stackoverflow.com/questions/11700320/is-string-literal-pool-a-collection-of-references-to-the-string-object-or-a-col/11701016#11701016

留下评论

网站地图xml地图