
Java 相关
wtmusic_9
这个作者很懒,什么都没留下…
展开
-
流的读取
String packName = getContext().getPackageName(); AssetManager manager = getContext().getAssets(); String[] fileName = manager.list("paths"); /*for (String str : fileName) { InputStream st...2011-05-14 14:59:56 · 111 阅读 · 0 评论 -
单例的一种实现方式
private static final Map mMap = new HashMap(); private File mStorageDirectory; /** * 根据不同的path,会创建不同的实例 * @param path 下载保存的路径,如childtongyao/shijingmp3 * @return */ public stati...原创 2011-05-17 10:48:46 · 102 阅读 · 0 评论 -
实现集合的排序功能
Collections.sort(myData, sDisplayNameComparator); return myData; } private final static Comparator sDisplayNameComparator = new Comparator() { private final Collator col...原创 2011-05-17 14:24:55 · 110 阅读 · 0 评论 -
http文件上传和普通字段
Android中集成了一个apache组织提供的一个开源的访问互联网的客户端程序 HttpClient 可以使用它来发送数据 这里有两个方法,是往互联网传送数据时候用的 一个是传送普通文本的,一个是传送带附件的 这两个方法就可以满足我们正常的所有需求了 public class HttpRequester { public static String po...原创 2011-07-13 16:55:29 · 269 阅读 · 0 评论 -
获取网络图片
public static void main(String[] args) throws IOException { URL url = new URL( "http://img.verycd.com/vcgroup/gface/48-48/143661.jpg"); HttpURLConnection conn = (HttpURLConnection) ur...原创 2011-07-15 11:40:48 · 81 阅读 · 0 评论 -
把一个文件转化成byte[] 数组
啥都不说了,给一个文件,返回给byte数组 // read the photo file into a byte array... public static byte[] getBytesFromFile(File file) throws IOException { InputStream is = new FileInputStream(file); // G...原创 2011-07-15 12:02:50 · 163 阅读 · 0 评论 -
httpClient 的简单实现
public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.yoursite.com/script....原创 2011-07-15 13:28:56 · 89 阅读 · 0 评论 -
SimpleDateFormat对日期的格式化
public static void main(String[] args) throws IOException, ParseException { String str = "2011-10-20 11:10:10"; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); D...原创 2011-07-23 17:12:23 · 140 阅读 · 0 评论 -
解压zip文件
/** * 解压zip文件到指定的xml文件 * * @param zipFileName * 文件名及目录 * @param outputDirectory * 解压到的目录 */ private void unzip(final String zipFileName, final String o...原创 2011-08-04 14:14:00 · 125 阅读 · 0 评论