Category Archives: code example

Writing an ORC File Using Java

So, I saw this question sometime ago on Stack Overflow and I’ve been meaning to answer this for sometime.  The question: How to convert .txt / .csv file to ORC format. Below is a code sample of how to do it … Continue reading

Posted in code example, coding, github, hadoop, java, programming | Tagged , , , | 10 Comments

Embedded List of Records Using Avro Generic Record

I’m posting this here, because I know someone out there will be Googling how to do this like I was. I didn’t find much and ended up spending a lot of time reading through the Avro API and using my … Continue reading

Posted in code example, coding, java | Tagged , , | Leave a comment

Java: Converting a List to an Array

For some reason, I always keep forgetting how to do this, without using a for-loop. import java.util.ArrayList;  import java.util.List; public class ConvertListToArray { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add(“test1”); list.add(“test2”); list.add(“test3”); String[] arrayOfStrings = … Continue reading

Posted in code example, java | Leave a comment

HttpClient with Feed Protocol

Took me a while to figure this out. If you’re using Apache’s HttpClient and need to change its default protocol from “http” to “feed”, this is how you do it in the code snippet below. HttpClient client = new HttpClient(); … Continue reading

Posted in code example, general, java | Leave a comment