Admin
Feb 25, 2022
16 comments
463
2.1. ClassLoader.getResourceAsStream() Use the getResourceAsStream() method to get the InputStream when reading a file from inside a jar file. Always use this method on the ClassLoader instance. private InputStream getFileAsIOStream(final St...
Snippet
Read a file from the ‘resources’ folder
Admin
Feb 09, 2021
2 comments
395
String jsonData = "[\r\n" + " {\r\n" + " \"CompType\": \"Substrate\",\r\n" + " \"CompName\": \"80101-106DSA\",\r\n" + " \"CompRev\": \"BA\",\r\n" + " },\r\n" + " {\r\n" + " \"CompType\": \"Substrate\",\r\n" + " \"CompName\": \"80101-106J...
Snippet
Read JSON data into a list
Admin
May 26, 2018
22 comments
233
Client Code import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.Socket; public class Client { public static void main (String [] args ) throws IOExc...
Snippet
Sending files over network in Java
Admin
May 25, 2018
15 comments
156
package com.test1; import java.awt.AlphaComposite; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public c...
Snippet
Image Resizing in Java
@Override public void onClick(View v) { view = v; int id = v.getId(); switch (id) { case R.id.check_permission: if (checkPermission()) { Snackbar.make(view, "Permission already grant...
Snippet
Request Permission Code in Android