Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.BasicStroke;
import java.awt.Stroke;

import java.io.IOException;
import java.io.ObjectInputStream;

public class Main {
    public static Stroke readStroke(ObjectInputStream in) throws IOException, ClassNotFoundException {
        boolean wroteStroke = in.readBoolean();
        if (wroteStroke) {
            boolean serializedStroke = in.readBoolean();
            if (serializedStroke) {
                return (Stroke) in.readObject();
            } else {
                float[] dash = null;
                int dashLength = in.read();

                if (dashLength != 0) {
                    dash = new float[dashLength];
                    for (int i = 0; i < dashLength; i++) {
                        dash[i] = in.readFloat();
                    }
                }

                float lineWidth = in.readFloat();
                int endCap = in.readInt();
                int lineJoin = in.readInt();
                float miterLimit = in.readFloat();
                float dashPhase = in.readFloat();

                return new BasicStroke(lineWidth, endCap, lineJoin, miterLimit, dash, dashPhase);
            }
        } else {
            return null;
        }
    }
}