Skip to content

Instantly share code, notes, and snippets.

@kntmr
kntmr / ZipArchive1.java
Created January 31, 2017 08:31
java.util.zip.ZipOutputStream による ZIP アーカイブ 1
package sample;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
@kntmr
kntmr / MyRetriableHttpClient.java
Last active December 20, 2016 07:59
HttpRequestRetryHandler でリトライをカスタマイズするサンプル
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Optional;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
@kntmr
kntmr / InputStreamTest.java
Last active December 20, 2016 07:59
InputStream のカスタム Matcher
package sample;
import static sample.InputStreamTest.InputStreamMatchers.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@kntmr
kntmr / ZunDoko.java
Last active March 24, 2016 05:18
ZunDoko.java
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class ZunDoko {
enum Type {
ZUN("ズン"), DOKO("ドコ");
final String value;
Type(String v) {